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

"rustup component remove [component]" fails if component files do not exist. #2799

Closed
mlsvrts opened this issue Jun 18, 2021 · 1 comment
Closed

Comments

@mlsvrts
Copy link

mlsvrts commented Jun 18, 2021

Problem
rustup component remove [component] fails if component files do not exist. This, incidentally, will also break rustup update.

Windows had some issues, and after some repair my recently installed clippy executables were deleted. However, rustup was still of the opinion that clippy was installed, preventing me from updating/adding/removing components:

$ rustup component list | rg clippy
clippy-x86_64-pc-windows-msvc (installed)
$ rustup component remove clippy-x86_64-pc-windows-msvc
info: removing component 'clippy'
info: rolling back changes
error: failure removing component 'clippy-preview-x86_64-pc-windows-msvc', directory does not exist: 'bin/cargo-clippy.exe'

Steps

Here are the steps to produce this issue with the clippy component on windows:

  1. Add a component: rustup component add clippy-preview
  2. Manually delete C:\Users\[USERNAME]\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin\cargo-clippy.exe
  3. Run: rustup component remove clippy-x86_64-pc-windows-msvc

Possible Solution(s)
To workaround this issue, you can create empty files based on the error output of rustup component remove [x] until it succeeds, and then re-install the component.

I think to actually fix this issue, component remove should not panic when it tries to delete a file that does not exist, since its goal was to remove that file anyway.

Notes

Output of rustup --version: rustup 1.24.3 (ce5817a94 2021-05-31)
Output of rustup show:

Default host: x86_64-pc-windows-msvc
rustup home:  C:\Users\jacob.caughfield\.rustup
stable-x86_64-pc-windows-msvc (default)
rustc 1.53.0 (53cb7b09b 2021-06-17)
@mlsvrts mlsvrts added the bug label Jun 18, 2021
@rbtcollins
Copy link
Contributor

Duplicate of #1480

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

No branches or pull requests

2 participants