Problem
(h/t @mcclure for finding this rather annoying bug)
If you are on a system with an older .rustup folder, with or without a .cargo, rustup will declare success unconditionally, without updating anything. This also happens even if you request a default profile that is not installed, and, curiously, if you attempt to install rustup with a different default toolchain.
Steps
- Get a rustup install on a fresh system with an old
stable. I did this by installing rust 1.8, and then moving the toolchain and update-hashes folder. Make sure rustup update attempts to update, but don't let it finish.
- Run the rustup string from https://rustup.rs with the default install. It will say
info: updating existing rustup installation, but nothing will actually be updated.
- Delete
.cargo. Try again. It will recreate the .cargo folder, but again not update anything.
- Try installing it with a beta or nightly install, a toolchain that is definitely not installed. It will again not install anything. It will also not update the default!
The last step can be tested on an existing rustup install pretty easily (for testing the others I had to create a docker container), by trying to install rustup with the default set as beta (if you don't have beta installed).
Possible Solution(s)
I feel like we should have some additional prompts for the user here.
If the user is attempting to install a default toolchain that does exist in .rustup but is out of date, we should tell them: "You have an existing outdated toolchain installed in ~/.rustup. Would you like to update it? y/n"
If the user is attempting to install a default toolchain that does not exist in .rustup, we should just install it, and set it as default.
Notes
Output of rustup --version: rustup 1.21.1 (7832b2e 2019-12-20)
Output of rustup show:
Details
manishearth@bb1876555c6d:~$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home: /home/manishearth/.rustup
installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu (default)
1.8.0-x86_64-unknown-linux-gnu
active toolchain
----------------
stable-x86_64-unknown-linux-gnu (default)
rustc 1.8.0 (db2939409 2016-04-11)
cc @kinnison
Problem
(h/t @mcclure for finding this rather annoying bug)
If you are on a system with an older
.rustupfolder, with or without a.cargo, rustup will declare success unconditionally, without updating anything. This also happens even if you request a default profile that is not installed, and, curiously, if you attempt to install rustup with a different default toolchain.Steps
stable. I did this by installing rust 1.8, and then moving the toolchain and update-hashes folder. Make surerustup updateattempts to update, but don't let it finish.info: updating existing rustup installation, but nothing will actually be updated..cargo. Try again. It will recreate the.cargofolder, but again not update anything.The last step can be tested on an existing rustup install pretty easily (for testing the others I had to create a docker container), by trying to install rustup with the default set as beta (if you don't have beta installed).
Possible Solution(s)
I feel like we should have some additional prompts for the user here.
If the user is attempting to install a default toolchain that does exist in
.rustupbut is out of date, we should tell them: "You have an existing outdated toolchain installed in~/.rustup. Would you like to update it? y/n"If the user is attempting to install a default toolchain that does not exist in
.rustup, we should just install it, and set it as default.Notes
Output of
rustup --version: rustup 1.21.1 (7832b2e 2019-12-20)Output of
rustup show:Details
cc @kinnison