Repository navigation
rustup-init x86_64-pc-windows-gnu reparse links created in msys2 shell corrupted #488
Description
Activity
Thanks for the report.
The symlinking on windows uses a big ball of win32 code so it wouldn't surprise me it's got problems. The test suite passes here though so I wonder if there are platform differences causing the problems for you. What version of Windows are you on?
it's windows 10 home insider preview
version: 1511
os build: 14352.1002msys version: MINGW64_NT-10.0 2.5.0(0.297/5/3) x86_64
It sounds like msys is not converting the path to a windows-style path when you pass in the location of your custom toolchain directory. Could you give the exact command line you're using to invoke rustup?
Ah yes that's the problem. Used this command to link
rustup toolchain link test /d/projects/rust/rust/build/x86_64-pc-windows-gnu/stage2I've looked into it, and the problem is that while msys is for the most part converting the path to a windows-style path, it does not replace forward slashes with backslashes. It should be sufficient to do a simple find/replace, but it may be preferable to do some kind of canonicalization instead?
rust's fs::canonicalize doesn't play well with msys paths like this /d/projects/rust/rust/build/x86_64-pc-windows-gnu/stage2 . maybe a simple find/replace will suffice ?
@chlai88 msys is correctly converting the path to a window-style path (ie. with a drive letter) it's just not converting the forward slashes to backslashes. In most places windows doesn't care which type of slash is used and will happily accept a mix even, but for the more "raw" apis, like link creation, only backslashes work.
@Diggsey Can we convert the slashes ourselves at the time the link is created?
We can, the question is how: we can do a simple find and replace, or we could canonicalize the path. Also, we can fix this directly in rustup, or it could be fixed in the standard library - it's going to be an issue for anyone using the link creation functions with paths that may contain forward slashes.
I don't know if there's a place to fix this in std - rustup is making directory junctions directly instead of using the std symlink functions.
I think this is probably the bug I've been encountering trying to fix #812 (comment)
Using x86_64-pc-windows-gnu v0.1.12 rustup to link to a custom toolchain inside msys2 shell. The links created inside $USERPROFILE/.multirust/toolchains can be opened by
lsin msys2 shell but gives "'custom toolchain' not installed" whenrustup run custom_toolchain rustc.Under windows powershell or file explorer, when the links are opened it gives "'link' is not accessible, The filename, directory name, volume label syntax is incorrect".