Skip to content

rustup toolchain uninstall <toolchain> reports toolchain has been uninstalled without doing anything #3861

Closed
@scimas

Description

@scimas

Verification

Problem

A rustup toolchain uninstall <toolchain> invocation reports that the <toolchain> has been uninstalled even if there is no such toolchain present in the first place.

Steps

  1. Install rustup.
  2. Run rustup toolchain uninstall <toolchain> with literally anything in place of <toolchain>, "foo", 42, the smiley emoji (😄).
  3. Observe the output
    rustup toolchain uninstall 😄
    info: no toolchain installed for '😄'
    info: toolchain '😄' uninstalled
    

Even though rustup recognizes that there is no such toolchain, it still reports that it has been uninstalled.

Now it's of course not a big issue in a silly example like above, but gives the false impression of removing an actual toolchain without doing so. For example,

> rustup toolchain install 1.70.0
> rustup toolchain list

Which shows

stable-x86_64-unknown-linux-gnu (default)
1.70.0-x86_64-unknown-linux-gnu

So naturally you run rustup toolchain uninstall 1.70.0-x86_64-unknown-linux-gnu and you get

info: no toolchain installed for '1.70.0-x86_64-unkown-linux-gnu'
info: toolchain '1.70.0-x86_64-unkown-linux-gnu' uninstalled

If you're not careful while reading, and miss that "no," looks like the toolchain has indeed been removed.

Possible Solution(s)

This unconditional check for the non-existence of the path even after possibly finding that the toolchain doesn't exist may be the root cause.

Notes

No response

Rustup version

rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.78.0 (9b00956e5 2024-04-29)`

Installed toolchains

Default host: x86_64-unknown-linux-gnu
rustup home:  /home/scimas/.rustup

installed targets for active toolchain
--------------------------------------

aarch64-unknown-linux-gnu
wasm32-unknown-unknown
x86_64-unknown-linux-gnu

active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.78.0 (9b00956e5 2024-04-29)

OS version

Linux fedora 6.8.10-200.fc39.x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions