You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rustup proxies not longer working with symlink resolution since 1.28.0 #4224
the two errors I saw where both just showing that the call does to rustup install instead of cargo install (or other calls to cargo are done on rustup)
Possible Solution(s)
No response
Notes
No response
Rustup version
1.28.0
Installed toolchains
it happens with just one toolchain installed, tested with `stable-aarch64-apple-darwin` or `stable-x86_64-unknown-linux-gnu`
OS version
Ubuntu 18.04.2 LTS on the server, or newer ubuntu in docker images
Would be nice to get a bit closer to the root cause of this issue, do you think you can do that? Do you have a reproduction scenario that doesn't involve rustwide/docs.rs?
Would be nice to get a bit closer to the root cause of this issue, do you think you can do that? Do you have a reproduction scenario that doesn't involve rustwide/docs.rs?
not yet, below is something that works with rustwide only.
I don't know rustwide internals / the build process very well, so a more low level example will take more time.
I'll probably first try to find a way to downgrade rustup for rustwide.
It can be made a little faster by choosing a smaller docker base image:
[...]
// Create a new workspace in .workspaces/docs-builder
let workspace =
WorkspaceBuilder::new(Path::new(".workspaces/docs-builder"), "rustwide-examples")
// this is new
.sandbox_image(SandboxImage::remote(
"ghcr.io/rust-lang/crates-build-env/linux-micro",
)?)
.init()?;
[...]
* Maybe [`std::path::absolute`](https://doc.rust-lang.org/stable/std/path/fn.absolute.html) would help?
* Or else just `canonicalise` the parent path than rejoin the file name?
You mean in our rustwide code? Or rustup?
if rustwide, I first need to figure out why we actually canonicalize the paths before calling, that needs digging into old crater code before rustwide was extracted
I don't think canonicalizing the filename can ever work with symlinked proxies because rustup shims rely on the link name to know where to direct the command to whereas canonicalizing a symlink removes that information by design. Canonicalizing the parent directory should always be fine though.
On the rustup side we could remove symlink support and only hard link (we've had this symlink behaviour for a long time but hard linking used to take precedence). Or else there might be something we can do to fix whatever problem necessitated canonicalizing.
I don't think canonicalizing the filename can ever work with symlinked proxies because rustup shims rely on the link name to know where to direct the command to whereas canonicalizing a symlink removes that information by design. Canonicalizing the parent directory should always be fine though.
Explicitly setting arg0 could work but that's only available on Unix and not on Windows.
Not canonicalizing is probably easier.
Oh of course. It can be done on Windows too but we haven't added it to the standard library yet. We really should. And possibly make a cross-platform arg0 function. But I realise that doesn't help in this moment.
so, path::absolute doesn't work. My current hunch is that this is related to how rustwide maps the toolchain into the docker container, and it somehow breaks when we try to use symlinks
My current hunch is that this is related to how rustwide maps the toolchain into the docker container, and it somehow breaks when we try to use symlinks
Ah, could this be #4222? Which is definitely something we should fix.
My current hunch is that this is related to how rustwide maps the toolchain into the docker container, and it somehow breaks when we try to use symlinks
Ah, could this be #4222? Which is definitely something we should fix.
could be. From what I remember, the toolchain installation is done outside of docker on the host, and then the directory is mapped into the docker container.
I'm not 100% sure how docker maps filesystems, but I could imagine that even when we would switch to relative symlinks, this might not work, if the relative links points outside of the docker-mapped fileystem.
I got docs.rs build again by forcing rustwide to use 1.27.1 and blocking the self update.
I'll probably wait for #4222 / #4226 to be released and try again. If that doesn't work I have to dig a little deeper into how rustup works with the links/ shims, and also how exactly the toolchain is set up & linked into the rustwide docker containers.
There is a similar problem with the change to symlinks instead of hard links in the new version of rustup.
If you are on WSL, Windows can't follow symlinks. Due to this, RustRover users on windows can't select a WSL based toolchain, because both cargo and rustc are now symlinks to rustup, but windows can't follow those links: RUST-17235 Unable to add Rust toolchain on WSL
I don't know their code but judging from the error "can't fine Cargo" I guess it's testing existence of cargo by attempting to follow the symlink? Ideally they would only test if the symlink itself exists (in Rust that can be done with std::fs::symlink_metadata and in Java you'd use the NOFOLLOW_LINKS link option).
@ChrisDenton If this was Unix that's possible, but on Windows unfortunately it's not possible to follow symlinks on a linux filesystem, see my link above. So Java at least is unable to follow the link, or even consider the file as existing.
Right yes, what I was trying to say is that there doesn't appear to be a reason to follow the link. They are presumably only testing for existence so they don't need to follow symlinks.
changing the symlinks to relative didn't help, so rustwide (= docs.rs & crater & other users like shipyard) are currently frozen to the old rustup version.
I need to find time if it would help to change what exact folders are mapped into the docker container to see if I can make it work with symlinks, but I don't know much about docker mapping.
TEST_WORKDIR_PREFIX="/tmp" /home/runner/.cargo/bin/cargo llvm-cov --codecov --output-path codecov.json --workspace --features=virtiofs -- --skip integration --nocapture --test-threads=8
error: process didn't exit successfully: `/home/runner/.cargo/bin/rustup locate-project --message-format plain` (exit status: 1)
--- stdout
error: unexpected argument '--message-format' found
tip: to pass '--message-format' as a value, use '-- --message-format'
Usage: rustup[EXE] <--verbose|--quiet|+toolchain>
The proxy seems to work abnormally.
And if i run make ut-nextest directly on github actions runner's shell, the command run successfully. However run CARGO=/home/runner/.cargo/bin/cargo make ut-nextest reports error:
runner@fv-az1075-407:~/work/nydus/nydus$ CARGO=/home/runner/.cargo/bin/cargo make ut-nextest
Running unit tests with nextest...
TEST_WORKDIR_PREFIX="/tmp" RUST_BACKTRACE=1 /home/runner/.cargo/bin/cargo nextest run --no-fail-fast --filter-expr 'test(test) - test(integration)' --workspace --features=virtiofs --release
error: command `/home/runner/.cargo/bin/rustup metadata '--format-version=1' --all-features --filter-platform x86_64-unknown-linux-gnu` failed with exit status: 1
make: *** [Makefile:113: ut-nextest] Error 102
Version info here:
runner@fv-az1075-407:~/work/nydus/nydus$ rustup -V
rustup 1.28.1 (f9edccde0 2025-03-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.84.0 (9fc6b4312 2025-01-07)`
runner@fv-az1075-407:~/work/nydus/nydus$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home: /home/runner/.rustup
installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu (default)
1.84.0-x86_64-unknown-linux-gnu (active)
active toolchain
----------------
name: 1.84.0-x86_64-unknown-linux-gnu
active because: overridden by '/home/runner/work/nydus/nydus/rust-toolchain.toml'
installed targets:
x86_64-unknown-linux-gnu
changed the title [-]Rustwide fails due to symlink resolution with new rustup[/-][+]Rustup proxies not longer working with symlink resolution since 1.28.0[/+]on Mar 29, 2025
We're also affected by this issue. Our Windows builds currently rely on a slightly outdated Cygwin environment, and when cargo is called from Cygwin's sh.exe (through the symlink), we see error messages from rustup.
The following version of sh.exe is affected:
GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)
The latest sh.exe from Cygwin is not:
GNU bash, version 5.2.21(1)-release (x86_64-pc-cygwin)
I have not tested any versions in between, so I don't know which change in Cygwin caused rustup's symlinks to start working.
Unfortunately, updating the Cygwin environment used by our build is not trivial, so I have to ask: Is there a chance the change to using symlinks could be reverted due to the reported issues?
Activity
syphar commentedon Mar 4, 2025
cc @skius @Skgland
djc commentedon Mar 4, 2025
Would be nice to get a bit closer to the root cause of this issue, do you think you can do that? Do you have a reproduction scenario that doesn't involve rustwide/docs.rs?
ChrisDenton commentedon Mar 4, 2025
Quick workarounds I can think of:
std::path::absolutewould help?canonicalisethe parent path than rejoin the file name?syphar commentedon Mar 4, 2025
not yet, below is something that works with rustwide only.
I don't know rustwide internals / the build process very well, so a more low level example will take more time.
I'll probably first try to find a way to downgrade rustup for rustwide.
the rustwide / rustup example
The rustwide
docs-builderexample lets us see the error directly.It can be made a little faster by choosing a smaller docker base image:
syphar commentedon Mar 4, 2025
You mean in our rustwide code? Or rustup?
if rustwide, I first need to figure out why we actually canonicalize the paths before calling, that needs digging into old crater code before rustwide was extracted
ChrisDenton commentedon Mar 4, 2025
On the rustwide side.
I don't think canonicalizing the filename can ever work with symlinked proxies because rustup shims rely on the link name to know where to direct the command to whereas canonicalizing a symlink removes that information by design. Canonicalizing the parent directory should always be fine though.
On the rustup side we could remove symlink support and only hard link (we've had this symlink behaviour for a long time but hard linking used to take precedence). Or else there might be something we can do to fix whatever problem necessitated canonicalizing.
syphar commentedon Mar 4, 2025
I'm still trying to figure that out. It was added in rust-lang/crater@2c3e40c, but no specific explaination as to why.
I will see if I can figure out something here. ( hoping it's the only issue )
Skgland commentedon Mar 4, 2025
Explicitly setting arg0 could work but that's only available on Unix and not on Windows.
Not canonicalizing is probably easier.
ChrisDenton commentedon Mar 4, 2025
Oh of course. It can be done on Windows too but we haven't added it to the standard library yet. We really should. And possibly make a cross-platform
arg0function. But I realise that doesn't help in this moment.syphar commentedon Mar 4, 2025
so,
path::absolutedoesn't work. My current hunch is that this is related to how rustwide maps the toolchain into the docker container, and it somehow breaks when we try to use symlinkssyphar commentedon Mar 4, 2025
this also doesn't work. Not sure why yet
ChrisDenton commentedon Mar 4, 2025
Ah, could this be #4222? Which is definitely something we should fix.
syphar commentedon Mar 4, 2025
could be. From what I remember, the toolchain installation is done outside of docker on the host, and then the directory is mapped into the docker container.
syphar commentedon Mar 5, 2025
an additional thought:
I'm not 100% sure how docker maps filesystems, but I could imagine that even when we would switch to relative symlinks, this might not work, if the relative links points outside of the docker-mapped fileystem.
1 remaining item
syphar commentedon Mar 5, 2025
I got docs.rs build again by forcing rustwide to use 1.27.1 and blocking the self update.
I'll probably wait for #4222 / #4226 to be released and try again. If that doesn't work I have to dig a little deeper into how rustup works with the links/ shims, and also how exactly the toolchain is set up & linked into the rustwide docker containers.
ChrisDenton commentedon Mar 5, 2025
Ok, new release should be out now. Sorry for the delay, unfortunately the release process is not anywhere near as simple as pressing a button.
syphar commentedon Mar 5, 2025
so #4226 is in that release?
syphar commentedon Mar 5, 2025
sorry, saw it in the release notes.
Will look if it works now later
ceronman commentedon Mar 7, 2025
There is a similar problem with the change to symlinks instead of hard links in the new version of
rustup.If you are on WSL, Windows can't follow symlinks. Due to this, RustRover users on windows can't select a WSL based toolchain, because both
cargoandrustcare now symlinks torustup, but windows can't follow those links: RUST-17235 Unable to add Rust toolchain on WSLChrisDenton commentedon Mar 7, 2025
I don't know their code but judging from the error "can't fine Cargo" I guess it's testing existence of
cargoby attempting to follow the symlink? Ideally they would only test if the symlink itself exists (in Rust that can be done withstd::fs::symlink_metadataand in Java you'd use theNOFOLLOW_LINKSlink option).ceronman commentedon Mar 7, 2025
@ChrisDenton If this was Unix that's possible, but on Windows unfortunately it's not possible to follow symlinks on a linux filesystem, see my link above. So Java at least is unable to follow the link, or even consider the file as existing.
ChrisDenton commentedon Mar 7, 2025
Right yes, what I was trying to say is that there doesn't appear to be a reason to follow the link. They are presumably only testing for existence so they don't need to follow symlinks.
syphar commentedon Mar 17, 2025
short update also here, coming from this comment:
changing the symlinks to relative didn't help, so rustwide (= docs.rs & crater & other users like shipyard) are currently frozen to the old rustup version.
I need to find time if it would help to change what exact folders are mapped into the docker container to see if I can make it work with symlinks, but I don't know much about docker mapping.
BraveY commentedon Mar 25, 2025
The
nextestalso reports an error in nextest-rs/nextest#2246, due to symlink resolution with new rustup.I have a simliar problem here. As commend in nextest-rs/nextest#2246, Our action got this error:
and another error here:
The proxy seems to work abnormally.
And if i run
make ut-nextestdirectly on github actions runner's shell, the command run successfully. However runCARGO=/home/runner/.cargo/bin/cargo make ut-nextestreports error:Version info here:
syphar commentedon Mar 25, 2025
You can see here: rust-lang/rustwide#97
how it was solved in rustwide, not sure if it helps
BraveY commentedon Mar 25, 2025
CC @sunshowers.
[-]Rustwide fails due to symlink resolution with new rustup[/-][+]Rustup proxies not longer working with symlink resolution since 1.28.0[/+]mbs-c commentedon Jun 26, 2025
We're also affected by this issue. Our Windows builds currently rely on a slightly outdated Cygwin environment, and when cargo is called from Cygwin's sh.exe (through the symlink), we see error messages from rustup.
The following version of sh.exe is affected:
The latest sh.exe from Cygwin is not:
I have not tested any versions in between, so I don't know which change in Cygwin caused rustup's symlinks to start working.
Unfortunately, updating the Cygwin environment used by our build is not trivial, so I have to ask: Is there a chance the change to using symlinks could be reverted due to the reported issues?
ChrisDenton commentedon Jun 26, 2025
With the latest rustup you can use the
RUSTUP_HARDLINK_PROXIES=1environment variable to hard link proxies.