Skip to content

rustup.rs install should update old toolchains #2330

@Manishearth

Description

@Manishearth

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

  1. 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.
  2. 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.
  3. Delete .cargo. Try again. It will recreate the .cargo folder, but again not update anything.
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions