rust-lang / rustup

The Rust toolchain installer
https://rust-lang.github.io/rustup/
Apache License 2.0
6.1k stars 877 forks source link

Make downgrading via the archives work #1158

Open brson opened 7 years ago

brson commented 7 years ago

I expect this to work:

RUSTUP_UPDATE_ROOT=https://dev-static.rust-lang.org/rustup/archive/1.2.0 rustup self update

but it does not:

info: checking for self-updates
error: could not download file from 'https://dev-static.rust-lang.org/rustup/archive/1.2.0/release-stable.toml' to '/tmp/rustup-update.6RjOKF0hq6Ji/release-stable.toml'
info: caused by: http request returned an unsuccessful status code: 404

I suspect it used to but broke once the 'release-stable.toml' file was added.

Probably just use another environment variable like RUSTUP_UPDATE_VERSION, which circumvents the 'release-stable.toml' file and appends the appropriate archive path to the update root.

This could be useful in the case of deploying a bad rustup (where the updater still works).

pickfire commented 6 years ago

@brson The URL get an 404 error. Is this still valid?

brson commented 6 years ago

@pickfire It's still valid.

Hard to recall details, but that URL in the op is a directory, so the tooling probably appends additional paths to the URLs it calls.

Here's the current output of the command in the op (though I've changed the URL to "static.rust-lang.org" instead of "dev-static", because I've forgotten what the difference is.

$ RUSTUP_UPDATE_ROOT=https://static.rust-lang.org/rustup/archive/1.2.0 rustup self update
info: checking for self-updates
error: could not download file from 'https://static.rust-lang.org/rustup/archive/1.2.0/release-stable.toml' to 'C:\cygwin64\tmp\rustup-update.52u9JHERUyFq\release-stable.toml'
info: caused by: http request returned an unsuccessful status code: 404

That's with rustup 1.13.0 (ea9259c1b 2018-07-16).

rustup only knows how to update to what's in release-stable.toml, the thing that says what the current version of rustup is, and there's no such file in the archives.

An easy hack to fix this is to add a fallback search after release-stable is not found that looks for the updater in whatever place makes this use case work.

kinnison commented 3 years ago

I'd suggest simply adding an argument to rustup self update a'la rustup self update --version 1.20.0 or similar. Though I'm unsure if it's still desirable to offer users an easy way to downgrade rustup.

kinnison commented 3 years ago

If this is still desirable in some form, please ping me, otherwise I've marked this inactive and will close at some point in the near future.