Skip to content

v1.28.0 broke rustup show active-toolchain #4217

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
Tracked by #4219
Sky9x opened this issue Mar 4, 2025 · 3 comments · Fixed by #4221
Closed
Tracked by #4219

v1.28.0 broke rustup show active-toolchain #4217

Sky9x opened this issue Mar 4, 2025 · 3 comments · Fixed by #4221
Labels

Comments

@Sky9x
Copy link

Sky9x commented Mar 4, 2025

Problem

IntelliJ RustRover and scripts use rustup show active-toolchain to get the active toolchain name. The output is now broken as it includes a message "active because: it's the default toolchain" on a second line.
This happened in #3225.

$ rustup show active-toolchain --help
Show the active toolchain

Usage: rustup[EXE] show active-toolchain [OPTIONS]

Options:
  -v, --verbose  Enable verbose output with rustc information
  -h, --help     Print help

Discussion:
    Shows the name of the active toolchain.

    This is useful for figuring out the active tool chain from
    scripts.

    You should use `rustc --print sysroot` to get the sysroot, or
    `rustc --version` to get the toolchain version.

This is useful for figuring out the active tool chain from scripts.

Which is why it should output exactly the toolchain name, nothing more.

Steps

Current output (v1.28.0):

$ rustup show active-toolchain
nightly-x86_64-unknown-linux-gnu
active because: it's the default toolchain

Gives this chaotic error when loading any project in RustRover:

Execution failed (exit code 1).
/home/sky9/.cargo/bin/cargo "+nightly-x86_64-unknown-linux-gnu
active because: it's the default toolchain" vendor --respect-source-config /home/sky9/.cache/JetBrains/RustRover2025.1/intellij-rust/stdlib/1.87.0-nightly-c16751b793dfce34909c1ba3fd1cbf4f827d7deb/vendor
    in working directory: /home/sky9/.cache/JetBrains/RustRover2025.1/intellij-rust/stdlib-local-copy/1.87.0-nightly-9375198e512f5c5ff5ae71857b1e38933ec1941d/library/sysroot
    with extra environment variables: RUSTC_BOOTSTRAP=1 TERM=ansi RUST_BACKTRACE=short RUSTC=/home/sky9/.cargo/bin/rustc
stdout: error: toolchain 'nightly-x86_64-unknown-linux-gnu
active because: it's the default toolchain' is not installed

stderr: 

It is trying to find a toolchain with the name nightly-x86_64-unknown-linux-gnu\nactive because: it's the default toolchain (with a newline in the middle) which obviously doesn't exist.

Previous output (v1.27.1 and below):

$ rustup show active-toolchain
nightly-x86_64-unknown-linux-gnu (default)

Possible Solution(s)

A v1.28.1 should be released with a patch reverting just the rustup show active-toolchain output back to pre-1.28.0 behavior.

Rustup version

rustup 1.28.0 (6e19fbec7 2025-03-02)

cc @majaha @rami3l @rust-lang/rustup

@Sky9x Sky9x added the bug label Mar 4, 2025
@Dchll
Copy link

Dchll commented Mar 4, 2025

I also came across

@djc djc mentioned this issue Mar 4, 2025
4 tasks
@majaha
Copy link
Contributor

majaha commented Mar 4, 2025

Just for clarity: the previous output of rustup show active-toolchain was:

stable-x86_64-pc-windows-msvc (default)

Note the brackets at the end. So something like cargo +$(rustup show active-toolchain) foo wouldn't have worked (and this specific instance isn't useful, as it sets the active toolchain to the active toolchain.)

The intention was to make it easier to parse in scripts, because you can split on the newline to get the toolchain name, while also making the reason-for-active much more intuitive.

I'm not sure what Rust Rover was doing, but breaking it probably isn't good. Perhaps they were cutting out the brackets directly.

@RalfJung
Copy link
Member

RalfJung commented Mar 5, 2025

FWIW this change also broke some logic in miri-test-libstd (that I already fixed by now), where it was using this rune to get the toolchain name:

rustup show active-toolchain | cut -f 1 -d' '

I have now changed this to

rustup show active-toolchain | head -n1 | cut -f 1 -d' '

The newline indeed makes it easier to parse, but unfortunately throws off existing parsers... so yeah the revert is probably a good idea. Would be nice to clean this up eventually, but that seems non-trivial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants