Skip to content

Follow symlinks in sysroot #11750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 24, 2014
Merged

Follow symlinks in sysroot #11750

merged 3 commits into from
Jan 24, 2014

Conversation

bnoordhuis
Copy link
Contributor

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.

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'
@alexcrichton
Copy link
Member

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.

@bnoordhuis
Copy link
Contributor Author

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.

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.

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.

@thestinger
Copy link
Contributor

@bnoordhuis: yeah, it's unrelated breakage from LLVM being updated AFAIK

@alexcrichton
Copy link
Member

Ah sorry yeah that's a lot of fallout right now from us trying to upgrade LLVM.

I agree that self_exe_name is a good function to have. I'm gonna push this through bors again and I'll rebase my changes later on top of this.

@alexcrichton
Copy link
Member

I forgot to say this earlier, but of course, thanks for the patch!

bors added a commit that referenced this pull request Jan 24, 2014
…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.
@bors bors closed this Jan 24, 2014
@bors bors merged commit 51103c8 into rust-lang:master Jan 24, 2014
flip1995 pushed a commit to flip1995/rust that referenced this pull request Nov 16, 2023
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Symlinked rustc can't find sysroot
4 participants