Fix file path separator decoded from manifest is not correct on Windows#3077
Fix file path separator decoded from manifest is not correct on Windows#3077rhysd wants to merge 1 commit intorust-lang:masterfrom
Conversation
|
Can I have some review from maintainer? If something is blocking review, I'll happily try to resolve it. So please let me know. |
|
Thanks for your patch. I'll take a look tomorrow. |
|
Does |
|
File path separator on Windows is I don't know why it works currently, but I think it would be canonicalized in some layer. |
|
It currently works because the Win32 APIs are flexible. The NT api that underlies it is not, and if we pass in \?\ style paths to the Win32 API it will also not be flexible, from memory. Canonicalising it is the right thing to do. I haven't read the patch at this point, just wanted to say thanks for taking this on and its clearly the right outcome to aim for. |
|
rustup uses As @rbtcollins kindly shared the thought, I think the current behavior is depending on some implementation details of platform-specific API. |
| line.find(':').map(|pos| { | ||
| Self( | ||
| line[0..pos].to_owned(), | ||
| PathBuf::from_slash(&line[(pos + 1)..]), |
There was a problem hiding this comment.
Hi, I've had a look at this. I think the change should be localised to the rename path, rather than the manifest: the change you've made will result in different manifests in the rustup dir depending on OS - that will interact badly with rustup dirs shared on NFS and the like.
I'm not entirely sure that the extra library is worth it - since we're only doing a relatively small number of these operations the overhead of a deconstruct to segments and reconstruct will be quite inivisble.
42 /home/robertc/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/manifest-cargo-x86_64-unknown-linux-gnu
5 /home/robertc/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/manifest-clippy-preview-x86_64-unknown-linux-gnu
26 /home/robertc/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/manifest-rust-analysis-x86_64-unknown-linux-gnu
25 /home/robertc/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/manifest-rustc-x86_64-unknown-linux-gnu
1 /home/robertc/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/manifest-rust-docs-x86_64-unknown-linux-gnu
5 /home/robertc/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/manifest-rustfmt-preview-x86_64-unknown-linux-gnu
1466 /home/robertc/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/manifest-rust-src
32 /home/robertc/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/manifest-rust-std-x86_64-unknown-linux-gnu
1602 total
There was a problem hiding this comment.
@rbtcollins One of our tests is also plagued with this issue, so I doubt whether it's really reasonable to localize the change to the rename path. The snippet below has nothing to do with renaming I assume:
Lines 389 to 425 in 6fa21c2
... also, so far the only call site to .decode() is in DirectoryPackage::install().
There was a problem hiding this comment.
different manifests in the rustup dir depending on OS
@rbtcollins I think that can be resolved by putting from_slash() in .decode() and to_slash() in .encode()... Performance-wise it won't make that much of a difference, right?
|
I'd like to take another look at this... The underlying problem definitely needs more attention anyways. |
|
Sorry, I've been having relatively low bandwidth in the past month due to the holiday season... But I'm trying to keep up. I think one proper way out would probably be making an extension to Thus, I think it might be better to do |
|
I'm closing this now in favor of #4179. Thanks again for helping out, @rhysd! |
While installing
rust-doccomponent on Windows, I noticed the following log messages in the output.This log message itself was not a problem, but some path separators were not correct
...\stable-x86_64-pc-windows-msvc\share/doc/rust/html.After taking a look at sources of rustup, I understood the cause was that the
share/doc/rust/htmlpart was decoded frommanifest.indirectly without converting path separators. This PR fixes it.