Skip to content
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

bootstrap: Avoid Invalid cross-device link (os error 18) for downloads #124359

Closed
wants to merge 1 commit into from

Conversation

Enselic
Copy link
Member

@Enselic Enselic commented Apr 25, 2024

When I do

src/ci/docker/run.sh --dev armhf-gnu
../x test --target arm-unknown-linux-gnueabihf tests/ui/compiletest-self-test/test-aux-bin.rs

I get

downloading https://static.rust-lang.org/dist/2024-03-19/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz
################################################################################### 100.0%
thread 'main' panicked at src/core/download.rs:211:9:
std::fs::rename(&tempfile, dest_path) failed with Invalid cross-device link (os error 18) ("failed to rename \"/checkout/obj/build/tmp/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz\" to \"/home/martin/.cache/x-cache/2024-03-19/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz\"")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Build completed unsuccessfully in 0:00:00

in WSL2. Fix this by downloading the temp file to the same file system as the destination file.

When I do

    src/ci/docker/run.sh --dev armhf-gnu
    ../x test --target arm-unknown-linux-gnueabihf \
            tests/ui/compiletest-self-test/test-aux-bin.rs

I get

    thread 'main' panicked at src/core/download.rs:211:9:
    std::fs::rename(&tempfile, dest_path) failed with
    Invalid cross-device link (os error 18)

in WSL2. Fix this by downloading the temp file to the same file system
as the destination file.
@rustbot
Copy link
Collaborator

rustbot commented Apr 25, 2024

r? @clubby789

rustbot has assigned @clubby789.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Apr 25, 2024
let tempfile = self.tempdir().join(dest_path.file_name().unwrap());
// Download to the same directory as the final file to avoid having to move it across file systems.
let mut tempfile = dest_path.to_owned();
tempfile.set_extension("incomplete-bootstrap-download");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A .partial extension is commonly added for partial downloads.

@bjorn3
Copy link
Member

bjorn3 commented Apr 25, 2024

Why is the /home/martin/.cache/x-cache directory used? Shouldn't it be moved from build/tmp to build/cache. I can't find any reference to x-cache in this repo.

@Enselic
Copy link
Member Author

Enselic commented Apr 25, 2024

Why is the /home/martin/.cache/x-cache directory used? Shouldn't it be moved from build/tmp to build/cache. I can't find any reference to x-cache in this repo.

Oops, sorry, I didn't realize I had

bootstrap-cache-path = "/home/martin/.cache/x-cache"

in cargo.toml. So bootstrap is simply doing as instructed, but the instructions are wrong. Closing...

@Enselic Enselic closed this Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants