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 self update doesn't update DisplayVersion #3739

Closed
ave9858 opened this issue Mar 24, 2024 · 7 comments · Fixed by #3770
Closed

rustup self update doesn't update DisplayVersion #3739

ave9858 opened this issue Mar 24, 2024 · 7 comments · Fixed by #3770
Labels
Milestone

Comments

@ave9858
Copy link

ave9858 commented Mar 24, 2024

Problem

When updating rustup from a prior release using rustup update, the DisplayVersion in the registry isn't updated from the old release version. This will result in tools like winget thinking rustup is outdated, and might confuse users.

Steps

  1. Install an older release of rustup that sets DisplayVersion such as 1.26.0
  2. Run rustup update, and check that rustup is updated to the latest version
  3. Open the "Uninstall a program" menu in control panel or check HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Rustup in the registry to see the outdated version number

Possible Solution(s)

Maybe do_add_to_programs isn't called for updates? I haven't checked the code yet.

Notes

Related to #3047 and #3055

Rustup version

rustup 1.27.0 (bbb9276d2 2024-03-08)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.77.0 (aedd173a2 2024-03-17)`

Installed toolchains

Default host: x86_64-pc-windows-msvc
rustup home:  C:\Users\User\.rustup

stable-x86_64-pc-windows-msvc (default)
rustc 1.77.0 (aedd173a2 2024-03-17)
@ave9858 ave9858 added the bug label Mar 24, 2024
@rami3l rami3l added this to the 1.27.1 milestone Mar 25, 2024
@rami3l
Copy link
Member

rami3l commented Mar 25, 2024

@ave9858 Thanks for filing this issue!

Unfortunately I don't currently use Windows and I wonder how exactly winget expect DisplayVersion to change, and I'm curious about how we would be able to verify the fix if it's ever made. @jedieaston maybe you as the original author of #3047 can provide more context on this one?

https://github.com/rust-lang/rustup/pull/3047/files only handles the addition of DisplayVersion on installation. I think running do_add_to_programs() during a self update may be overwhelming though, and a better thing to do would be extracting the addition into a function and use it in both rustup-init and rustup self update.

@djc
Copy link
Contributor

djc commented Mar 25, 2024

Also cc @ChrisDenton as our resident Windows expert?

@ChrisDenton
Copy link
Member

Looking at

pub(crate) fn do_add_to_programs() -> Result<()> {
@rami3l's plan looks good to me. It seems like updating the DisplayVersion would be enough but I guess the only tricky thing would be to make sure it doesn't overwrite another installation of rustup. Not that rustup particularly supports having two concurrent installs.

@rami3l rami3l modified the milestones: 1.27.1, 1.28.0 Apr 9, 2024
@rami3l
Copy link
Member

rami3l commented Apr 28, 2024

@ave9858 A new beta release is available, would you mind trying it out?

@ave9858
Copy link
Author

ave9858 commented Apr 28, 2024

@ave9858 A new beta release is available, would you mind trying it out?

image

Still seeing the old version number in control panel after updating to the beta, and I confirmed the old number is shown in the registry also. I first installed Rustup 1.27.0 (via update from 1.26.0 and normal install from https://www.rust-lang.org/tools/install) and then enabled beta via set RUSTUP_UPDATE_ROOT=https://dev-static.rust-lang.org/rustup in cmd. After, I ran rustup self update and saw the version number didn't change.

@ave9858
Copy link
Author

ave9858 commented Apr 28, 2024

Looks like a downgrade triggered by removing the RUSTUP_UPDATE_ROOT env var will set the version correctly. Tested by installing 1.26.0, updating to 1.27.0 (display version not updated), updating to 1.27.1 (display var not updated), then running rustup self update in a shell without the variable set, which downgrades to 1.27.0 and updates the display version.

@rami3l
Copy link
Member

rami3l commented Apr 28, 2024

Looks like a downgrade triggered by removing the RUSTUP_UPDATE_ROOT env var will set the version correctly. Tested by installing 1.26.0, updating to 1.27.0 (display version not updated), updating to 1.27.1 (display var not updated), then running rustup self update in a shell without the variable set, which downgrades to 1.27.0 and updates the display version.

Then it's working as expected (the code changes wasn't there in v1.27.0 so those particular upgrades won't work, but all the upgrades performed on v1.27.1+ should work). Thanks!

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

Successfully merging a pull request may close this issue.

4 participants