Skip to content

Rustwide fails due to symlink resolution with new rustup #94

@skius

Description

@skius

Since rustup 1.28 PR rust-lang/rustup#4023, cargo-home/bin/cargo is symlinked to cargo-home/bin/rustup. As part of running a command, the binary's path is utils::normalize_path'd, which includes symlink resolution. As a result, cargo commands end up being called as rustup, for example, rustup install git-credential-null which results in an error.

I'm not sure, but a hacky fix could be to store the filename before resolution (the canonicalize call) and restore it afterwards?

rustwide/src/utils.rs

Lines 111 to 112 in 744375a

pub(crate) fn normalize_path(path: &Path) -> PathBuf {
let mut p = std::fs::canonicalize(path).unwrap_or_else(|_| path.to_path_buf());

For the short term, is there a way to override the rustup version being used short of changing the hardcoded URL?

Activity

syphar

syphar commented on Mar 4, 2025

@syphar
Member

Currently docs.rs builds are broken because of this: https://rust-lang.zulipchat.com/#narrow/channel/356853-t-docs-rs/topic/Last.20successful.20build.20was.2015.20hours.20ago

in the docs.rs team we're currently trying to find a way to freeze an older rustup version, but weren't successful yet

Skgland

Skgland commented on Mar 4, 2025

@Skgland
Contributor

Should this maybe also be reported to rustup?
It looks like they are planning a bugfix release 1.28.1, but I don't see a corresponding issue for the symlink/hardlink switch causing problems nor is it listen in rust-lang/rustup#4219

jstrong-lhava

jstrong-lhava commented on Mar 4, 2025

@jstrong-lhava

I tried this hacky fix, which solved the immediate problem (rustup install git-credential-null) but subsequent commands failed with ExecutionFailed(ExitStatus(unix_wait_status(32512))). Seems likely to be related but I can't find any other place in the code where paths are canonicalized or the code would otherwise fail due to symlinks vs. hardlinks. (in the same boat, trying to get docs to build at Shipyard.rs.)

pub(crate) fn normalize_path(orig_path: &Path) -> PathBuf {
    let mut p = std::fs::canonicalize(orig_path).unwrap_or_else(|_| orig_path.to_path_buf());

    if let Some(file_name) = orig_path.file_name() {
        if let Some(parent_dir) = p.parent() {
            p = parent_dir.join(file_name);
        }
    }

    // ..
}
syphar

syphar commented on Mar 5, 2025

@syphar
Member

I created a PR that will (for now) freeze the used rustup version to 1.27.1, and disable its self-update

syphar

syphar commented on Mar 5, 2025

@syphar
Member

I released 0.19.1 which freezes rustup to 1.27.1

self-assigned this
on Mar 5, 2025
jstrong-lhava

jstrong-lhava commented on Mar 6, 2025

@jstrong-lhava

thanks @syphar! was able to get docs building at shipyard.rs last night with the help of your PR.

have you determined whether rustup 0.28.1 works with rustwide builds (i.e. reverts the switch from hardlinks to symlinks)? haven't had time to check yet.

syphar

syphar commented on Mar 6, 2025

@syphar
Member

thanks @syphar! was able to get docs building at shipyard.rs last night with the help of your PR.

You're very welcome! Good to hear you're using rustwide in shipyard.rs too.

have you determined whether rustup 0.28.1 works with rustwide builds (i.e. reverts the switch from hardlinks to symlinks)? haven't had time to check yet.

It doesn't switch to hardlinks again, but changed absolute symlinks to relative symlinks. But it still doesn't work.

I'll have to dig into how exactly the rustup/cargo folders are mapped into the docker container so figure out why the symlinks don't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @syphar@Skgland@skius@jstrong-lhava

    Issue actions

      Rustwide fails due to symlink resolution with new `rustup` · Issue #94 · rust-lang/rustwide