Skip to content
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

Do not resolve symlinks when finding crates. #29433

Closed
wants to merge 1 commit into from
Closed

Do not resolve symlinks when finding crates. #29433

wants to merge 1 commit into from

Conversation

taralx
Copy link
Contributor

@taralx taralx commented Oct 28, 2015

The resolved path may not end in '.rlib', causing us to try to read the
archive as an object file.

The resolved path may not end in '.rlib', causing us to try to read the
archive as an object file.
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@taralx
Copy link
Contributor Author

taralx commented Oct 28, 2015

P.S. If there's a way to cherry-pick this into stable, that would be really nice.

@retep998
Copy link
Member

If we're not going to use the result of canonicalize wouldn't it be better to just check whether the file exists? Also there's probably a good reason it uses canonicalize.

@taralx
Copy link
Contributor Author

taralx commented Oct 28, 2015

I went with a minimal change, but I can certainly switch to "file exists" if that's what's preferred. Canonicalize saves lookups later, but can result in a completely different filename.

In our case, the cloud builder creates symlinks of the form libcore-xyzzy.rlib -> /network/cas/$FILEHASH. Canonicalizing causes a "cannot find crate 'core'" error.

The alternative is to not rely on the filename past this point, making sure to pass down rlib-ness (and possibly more) as a parameter.

@eefriedman
Copy link
Contributor

For reference, the behavior of resolving symlinks was added in #12474. I'm not sure if the original reason for adding that behavior is still relevant.

@alexcrichton might have something to say about it?

@taralx
Copy link
Contributor Author

taralx commented Oct 28, 2015

Apparently it does still matter. Okay, so I'll close this and rework it to not rely on the filename after canonicalization.

@taralx taralx closed this Oct 28, 2015
@taralx taralx deleted the patch-1 branch February 25, 2016 21:43
bors added a commit that referenced this pull request Apr 13, 2016
Do not rely on file extensions after path canonicalization.

Rustc does not recognize libraries which are symlinked to files having extension other than .rlib. The problem is that find_library_crate calls fs::canonicalize on found library paths, but then the resulting path is passed to get_metadata_section, which assumes it will end in ".rlib" if it's an rlib (from https://internals.rust-lang.org/t/is-library-path-canonicalization-worth-it/3206).

cc #29433
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.

5 participants