Follow symlinks in sysroot - #11750
Conversation
Before this commit, rustc looked in `dirname $0`/../lib for libraries but that doesn't work when rustc is invoked through a symlink. This commit makes rustc look in `dirname $(readlink $0)`/../lib, i.e. it first canonicalizes the symlink before walking up the directory tree. Fixes #3632.
Fixes the following error when executing `make check-lite`:
Traceback (most recent call last):
File "/home/bnoordhuis/src/rust/src/etc/check-summary.py", line 27, in <module>
map(summarise, logfiles)
File "/home/bnoordhuis/src/rust/src/etc/check-summary.py", line 10, in summarise
with open(fname) as fd:
IOError: [Errno 2] No such file or directory: 'tmp/*.log'
|
This is similar to what I implemented in #11734, but I'm not sure that this is the logic that we want for the general case. This only resolves one layer of symlinks, but not multiple layers. I do agree though that the overwhelming usage of symlinking rustc will be to symlink just the binary and none of the parent folders, though. |
|
Quick question, are the warnings from bors benign? I looked at the buildbot output and the failures seem unrelated to the actual change but I stress the 'seem', I don't really know.
I like your approach. I won't be offended if you reject my PR in favor of yours. Having self_exe_name() would be nice though. |
|
@bnoordhuis: yeah, it's unrelated breakage from LLVM being updated AFAIK |
|
Ah sorry yeah that's a lot of fallout right now from us trying to upgrade LLVM. I agree that |
|
I forgot to say this earlier, but of course, thanks for the patch! |
…nger Before this commit, rustc looked in `dirname $0`/../lib for libraries but that doesn't work when rustc is invoked through a symlink. This commit makes rustc look in `dirname $(readlink $0)`/../lib, i.e. it first canonicalizes the symlink before walking up the directory tree. Fixes #3632.
Replace if_chain with let chains Closes rust-lang#9353 Let chains are now supported by rustfmt 🎉 The PR is split into two commits 1. The result of running [`if-to-let-chain clippy*/**/*.rs`](https://github.com/Alexendoo/if-to-let-chain) 2. The manual clean up: fixing some errors/formatting, dogfood lints, removing the if_chain internal lint r? `@flip1995` changelog: none
Before this commit, rustc looked in
dirname $0/../lib for librariesbut that doesn't work when rustc is invoked through a symlink.
This commit makes rustc look in
dirname $(readlink $0)/../lib, i.e.it first canonicalizes the symlink before walking up the directory tree.
Fixes #3632.