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

xtask can't install toolchain #3243

Closed
lnicola opened this issue Feb 19, 2020 · 6 comments
Closed

xtask can't install toolchain #3243

lnicola opened this issue Feb 19, 2020 · 6 comments

Comments

@lnicola
Copy link
Member

lnicola commented Feb 19, 2020

I've had this for a long time, but I have no idea what's happening:

$ cargo test
[snip]
     Running target/debug/deps/tidy_tests-011c6372e455c154

running 6 tests
test cli::generated_tests_are_fresh ... ok
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
test docs::no_docs_comments ... ok
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
test cli::no_todo ... ok
info: latest update on 2020-01-30, rust version 1.41.0 (5e1a79984 2020-01-27)
info: downloading component 'cargo'
info: latest update on 2020-01-30, rust version 1.41.0 (5e1a79984 2020-01-27)
info: downloading component 'cargo'
info: latest update on 2020-01-30, rust version 1.41.0 (5e1a79984 2020-01-27)
info: downloading component 'cargo'
info: downloading component 'rust-std'
error: component download failed for cargo-x86_64-unknown-linux-gnu
error: caused by: could not rename file
test cli::generated_assists_are_fresh ... FAILED
error: component download failed for cargo-x86_64-unknown-linux-gnu
error: caused by: could not rename file
test cli::generated_grammar_is_fresh ... FAILED
info: downloading component 'rustc'
info: installing component 'cargo'
info: installing component 'rust-std'
info: installing component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'rustfmt'
test cli::check_code_formatting ... ok

failures:

---- cli::generated_assists_are_fresh stdout ----
> rustup toolchain install stable
thread 'cli::generated_assists_are_fresh' panicked at 'process `rustup toolchain install stable` failed. Please update assists by running `cargo xtask codegen`', xtask/tests/tidy-tests/cli.rs:24:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- cli::generated_grammar_is_fresh stdout ----
> rustup toolchain install stable
thread 'cli::generated_grammar_is_fresh' panicked at 'process `rustup toolchain install stable` failed. Please update it by running `cargo xtask codegen`', xtask/tests/tidy-tests/cli.rs:10:9


failures:
    cli::generated_assists_are_fresh
    cli::generated_grammar_is_fresh

test result: FAILED. 4 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '-p xtask --test tidy-tests'

$ rustup toolchain install stable                                                                                                                               info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.41.0 (5e1a79984 2020-01-27)

$ rustup toolchain remove stable                                                                                                                                  info: uninstalling toolchain 'stable-x86_64-unknown-linux-gnu'
info: toolchain 'stable-x86_64-unknown-linux-gnu' uninstalled

$ rustup toolchain install stable                                                                                                                                 info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2020-01-30, rust version 1.41.0 (5e1a79984 2020-01-27)
info: downloading component 'cargo'
info: downloading component 'rust-std'
info: downloading component 'rustc'
 57.9 MiB /  57.9 MiB (100 %)  19.8 MiB/s in  3s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-std'
 17.5 MiB /  17.5 MiB (100 %)  17.3 MiB/s in  1s ETA:  0s
info: installing component 'rustc'
 57.9 MiB /  57.9 MiB (100 %)  13.3 MiB/s in  4s ETA:  0s

  stable-x86_64-unknown-linux-gnu installed - rustc 1.41.0 (5e1a79984 2020-01-27)

$ cargo test -p xtask --test tidy-tests                                                                                                                           Finished test [unoptimized] target(s) in 0.04s
     Running target/debug/deps/tidy_tests-011c6372e455c154

running 6 tests
test docs::no_docs_comments ... ok
test cli::generated_tests_are_fresh ... ok
test cli::no_todo ... ok
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: downloading component 'rustfmt'
info: downloading component 'rustfmt'
info: downloading component 'rustfmt'
info: installing component 'rustfmt'
error: component download failed for rustfmt-x86_64-unknown-linux-gnu
error: caused by: could not rename file
test cli::generated_assists_are_fresh ... FAILED
error: component download failed for rustfmt-x86_64-unknown-linux-gnu
error: caused by: could not rename file
test cli::check_code_formatting ... FAILED
test cli::generated_grammar_is_fresh ... ok
@lnicola lnicola changed the title cargo test can't install toolchain xtask can't install toolchain Feb 19, 2020
@bjorn3
Copy link
Member

bjorn3 commented Feb 19, 2020

What is the exit code of rustup toolchain install stable? (echo $?)

@lnicola
Copy link
Member Author

lnicola commented Feb 19, 2020

0 when running it separately, but xtask seems to start it three times?

@matklad
Copy link
Member

matklad commented Feb 19, 2020 via email

@lnicola
Copy link
Member Author

lnicola commented Feb 20, 2020

/usr/bin/cargo and /usr/bin/rustc. I think it's trying to install it multiple times:

strace: Process 144753 attached
[pid 144753] execve("/usr/bin/rustup", ["rustup", "toolchain", "install", "stable"], 0x7ffe373e4488 /* 80 vars */) = 0
strace: Process 144754 attached
[pid 144754] execve("/usr/bin/rustup", ["rustup", "toolchain", "install", "stable"], 0x7ffe373e4488 /* 80 vars */) = 0
strace: Process 144755 attached
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
[pid 144755] execve("/usr/bin/rustup", ["rustup", "toolchain", "install", "stable"], 0x7ffe373e4488 /* 80 vars */) = 0

And I can reproduce it with:

$ rustup toolchain install stable & rustup toolchain install stable & rustup toolchain install stable
[1] 144862
[2] 144863
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2020-01-30, rust version 1.41.0 (5e1a79984 2020-01-27)
info: downloading component 'cargo'
476.2 KiB / 476.2 KiB (100 %) 350.2 KiB/s in  1s ETA:  0s
info: downloading component 'rust-std'
476.2 KiB / 476.2 KiB (100 %) 318.2 KiB/s in  1s ETA:  0s
info: latest update on 2020-01-30, rust version 1.41.0 (5e1a79984 2020-01-27)
info: downloading component 'cargo'
info: downloading component 'rust-std'
info: latest update on 2020-01-30, rust version 1.41.0 (5e1a79984 2020-01-27)
info: downloading component 'cargo'
info: downloading component 'rust-std'
info: downloading component 'rustc'
 57.9 MiB /  57.9 MiB (100 %)  18.0 MiB/s in  3s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-std'
 17.5 MiB /  17.5 MiB (100 %)  14.6 MiB/s in  1s ETA:  0s
 15.3 MiB /  17.5 MiB ( 87 %)   1.9 MiB/s in  6s ETA:  1sinfo: installing component 'rustc'
 17.5 MiB /  17.5 MiB (100 %)   2.5 MiB/s in  6s ETA:  0s
error: component download failed for rust-std-x86_64-unknown-linux-gnu
error: caused by: could not rename file
[1]  - 144862 exit 1     rustup toolchain install stable
 17.5 MiB /  17.5 MiB (100 %)   2.4 MiB/s in  6s ETA:  0s
error: component download failed for rust-std-x86_64-unknown-linux-gnu
error: caused by: could not rename file

@murlakatamenka
Copy link
Contributor

murlakatamenka commented Mar 23, 2020

Latest release also has this issue (built on stable Rust 1.42):

wget https://github.com/rust-analyzer/rust-analyzer/archive/2020-03-23.tar.gz
tar xf 2020-03-23.tar.gz
cd rust-analyzer-2020-03-23
cargo test -p xtask --test=tidy-tests

Sample output:

    Finished test [unoptimized] target(s) in 0.05s
     Running target/debug/deps/tidy_tests-b9f7d4d69054c5f5

running 5 tests
test cli::generated_tests_are_fresh ... ok
test cli::generated_assists_are_fresh ... ok
test rust_files_are_tidy ... ok
test cli::generated_grammar_is_fresh ... ok
test cli::check_code_formatting ... FAILED

failures:

---- cli::check_code_formatting stdout ----
> rustup run stable -- cargo fmt -- --check
Diff in /tmp/ra_test/rust-analyzer-2020-03-23/xtask/src/dist.rs at line 17:
     rm_rf(&dist)?;
     fs2::create_dir_all(&dist)?;
 
-    if let Some(ClientOpts { version, release_tag}) = client_opts {
+    if let Some(ClientOpts { version, release_tag }) = client_opts {
         dist_client(&version, &release_tag)?;
     }
     dist_server()?;
Diff in /tmp/ra_test/rust-analyzer-2020-03-23/xtask/src/main.rs at line 13:
 use pico_args::Arguments;
 use xtask::{
     codegen::{self, Mode},
-    dist::{ClientOpts, run_dist},
+    dist::{run_dist, ClientOpts},
     install::{ClientOpt, InstallCmd, ServerOpt},
     not_bash::pushd,
     pre_commit, project_root, run_clippy, run_fuzzer, run_pre_cache, run_release, run_rustfmt,
thread 'cli::check_code_formatting' panicked at 'process `rustup run stable -- cargo fmt -- --check` failed. Please format the code by running `cargo format`', xtask/tests/tidy-tests/cli.rs:30:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    cli::check_code_formatting

test result: FAILED. 4 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '-p xtask --test tidy-tests'

bors bot added a commit that referenced this issue Apr 30, 2020
4219: Avoid `rustup` invocation for non-rustup rust installation r=matklad a=oxalica

Fix #4218 and #3243.



Co-authored-by: oxalica <[email protected]>
@lnicola
Copy link
Member Author

lnicola commented Jan 22, 2021

Fixed in #4219.

@lnicola lnicola closed this as completed Jan 22, 2021
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

No branches or pull requests

4 participants