-
Notifications
You must be signed in to change notification settings - Fork 942
rustup default
no longer exits with 1
with no default toolchain is set
#4140
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
Comments
I figured out it is because I didn't have any default. Maybe we don't want to handle the missing default case? |
rustup show active-toolchain
exit 0 even when there is no active toolchainrustup show active-toolchain
exits 0 when no default and no active toolchain
I suspect this case had just never been considered. When can you end up with no default? Is it only after uninstalling all toolchains? |
Edit: ah you already said, sorry. |
For normal users,
I believe this is rare, but some environments might have no default. |
I think it may make sense to change it to an error if there is no active toolchain but then that won't help with migration. Unless we also backport the change. |
Hm, |
@weihanglo @ChrisDenton I believe this is a bug on our side. Will fix. |
The only thing here is that we need to make sure that our command return This includes at least |
Should we have a small "compatibility notes" section for these changes in our changelog, just like how rust release does? Anyway, thanks people for your help! |
@ChrisDenton A lot of these compat changes come from #3225. Apparently I was new to the team when reviewing this at the time and didn't understand the implications underneath... I'll try to do follow-up fixes for this. |
I can definitely sympathize with being new! Do we need to add this as a release blocker somewhere? |
@ChrisDenton Added to #3998 (comment). |
@ChrisDenton I just checked, it looks like Tested on Alpine Linux ARM64 with rustup v1.27.1: > rustup default none
info: default toolchain unset
> rustup show
Default host: aarch64-unknown-linux-musl
rustup home: /usr/local/rustup
no active toolchain
> echo $?
0 > rustup default
error: no default toolchain configured
> echo $?
1 > rustup show active-toolchain
> echo $?
0 ... or I was misunderstanding your reply? Anyway, I still consider the inconsistency between the latter two a bug, and It's just that |
Hm, in powershell on Windows 11:
|
rustup show active-toolchain
exits 0 when no default and no active toolchainrustup default
no longer exits with 1
with no default toolchain is set
@ChrisDenton That's a bit terrifying! Are there some pre-existing platform differences unrelated to #4141? I'd say I expect |
I'm not aware of any but then I wasn't aware of this difference. I'm not sure even why it's different, which worries me. Shouldn't our tests detect this? |
@ChrisDenton Just tested this on a borrowed Windows machine with rustup v1.28.0 beta: > rustup show
Default host: x86_64-pc-windows-gnu
rustup home: C:\Users\me\.rustup
installed toolchains
--------------------
stable-x86_64-pc-windows-gnu
stable-x86_64-pc-windows-msvc
nightly-x86_64-pc-windows-gnu
nightly-x86_64-pc-windows-msvc
nightly-2021-01-07-x86_64-pc-windows-msvc
nightly-2021-02-08-x86_64-pc-windows-msvc
active toolchain
----------------
no active toolchain ... so this error seems gone. rustup/tests/cli-inst-interactive.rs Lines 132 to 140 in d93c1c8
|
@ChrisDenton Looks like your particular rustup setup has failed when running this function, however this error is somehow not present on my machine (regardless of the platform): Lines 719 to 737 in 54dd3d0
... and the fallback-specific logic is disabled on Windows, that's what is directly causing this situation: Lines 272 to 283 in ef631dc
Do you happen to have a clue about this? What does your |
With
Weirdly I couldn't reproduce the issue when running in Windows sandbox but it does reproduce on two of my machines. Maybe it's something to do with my non-standard setup. 1.28 is fine though so I'm not sure if it's particularly worth investigating if it was just a bug in 1.27.1? |
@ChrisDenton A non-existent field for the default toolchain is perfectly expected. If rustup v1.28.0 beta doesn't have this issue for you then, well, I guess we should do nothing in that regard until the problem has resurfaced. For now, let's just focus on #4141. |
Verification
Problem
(Edited by @rami3l to better reflect the original issue)
Coming from https://internals.rust-lang.org/t/seeking-beta-testers-for-rustup-v1-28-0/22060.
With rustup v1.27.1, the following shell snippet can be used to force the installation of the default toolchain, or fall back on
stable
when none is present:rustup default || rustup default stable
When testing out the upcoming 1.28 release, however, I found that
rustup default
is returning0
even there's no such thing as the default toolchain, resulting in an unchanged default toolchain state.I've noticed the suggestion provided in the post:
... but it doesn't really help with the use case above, since regardless in 1.27.1, the current stable branch (1.28-beta), it seems to always exit with code 0.
1.27.1
rustup/src/cli/rustup_mode.rs
Lines 1227 to 1257 in 54dd3d0
stable
rustup/src/cli/rustup_mode.rs
Lines 1100 to 1105 in 7ccf717
Steps
rustup default none
rustup default || rustup default stable
Possible Solution(s)
Should we find another workaround?
Notes
No response
Rustup version
Installed toolchains
rustup 1.27.1
rustup 1.28.0
OS version
Both Darwin and Linux
The text was updated successfully, but these errors were encountered: