Skip to content

Rustwide fails due to symlink resolution with new rustup #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
skius opened this issue Mar 4, 2025 · 7 comments · Fixed by #97
Closed

Rustwide fails due to symlink resolution with new rustup #94

skius opened this issue Mar 4, 2025 · 7 comments · Fixed by #97
Assignees

Comments

@skius
Copy link

skius commented Mar 4, 2025

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?

@syphar
Copy link
Member

syphar commented Mar 4, 2025

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
Copy link
Contributor

Skgland commented Mar 4, 2025

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
Copy link

jstrong-lhava commented Mar 4, 2025

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
Copy link
Member

syphar commented Mar 5, 2025

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

@syphar
Copy link
Member

syphar commented Mar 5, 2025

I released 0.19.1 which freezes rustup to 1.27.1

@jstrong-lhava
Copy link

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
Copy link
Member

syphar commented Mar 6, 2025

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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants