Uh oh!
There was an error while loading. Please reload this page.
Do not rely on file extensions after path canonicalization. - #32828
Conversation
rust-highfive
commented
Apr 8, 2016
r? @nrc (rust_highfive has picked a reviewer for you, use r? to override) |
vadimcn
commented
Apr 8, 2016
Also, I'd like to nominate this fix for backporting into 1.8. |
| fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
| f.write_str(match *self { | ||
| CrateFlavor::Rlib => "rlib", | ||
| CrateFlavor::Dylib => "dylib" |
There was a problem hiding this comment.
Could you add a comma at the end of this line please?
alexcrichton
commented
Apr 8, 2016
This seems pretty similar to #32317 in scope, but perhaps somewhat different in terms of problem solved? Could you also be sure to add a test for this as well? |
vadimcn
commented
Apr 8, 2016
No, I think it's the same issue. Wasn't aware #32317 existed. |
alexcrichton
commented
Apr 8, 2016
I think that #32317 is arguably more general, but I somewhat prefer this tactic as it solves the problem at hand without changing the semantics that much |
alexcrichton
commented
Apr 8, 2016
cc @taralx |
vadimcn
commented
Apr 9, 2016
Added a test in case you want to go with this one. |
taralx
commented
Apr 9, 2016
This fixes the problem that I have specifically, although #32317 is probably also worth doing long-term (once I work out what's broken about Windows with it). |
alexcrichton
commented
Apr 11, 2016
bors
commented
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
bors
commented
Apr 13, 2016
eddyb
commented
Apr 13, 2016
Nominating for backport on behalf of @taralx. |
nikomatsakis
commented
Apr 21, 2016
Discussed in @rust-lang/compiler meeting. Is this fixing a regression or just some longstanding bug? |
taralx
commented
Apr 21, 2016
This is technically a regression due to #12474. Before that, symlinks named *.rlib worked, regardless of the name of the thing they pointed to. |
alexcrichton
commented
Apr 21, 2016
@nikomatsakis I believe, (ias @taralx pointed out) that this is just fixing a longstanding bug |
nikomatsakis
commented
Apr 27, 2016
In that case, I believe (based on consensus from previous @rust-lang/compiler meeting) we would prefer not to backport. |
vadimcn
commented
Apr 27, 2016
@rust-lang/compiler: Can you please reconsider? This prevents Rust builds from working on our build cluster. I believe this is a pretty non-invasive change, and the beta cycle has just started.... |
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