Open polarathene opened 4 months ago
The rustup docs imply that it should be using the configured minimal
profile as fallback:
Note that if not specified, the
default
profile is not necessarily used, as a different default profile might have been set withrustup set profile
.
@polarathene Thanks for your in-depth investigation! I believe this is covered by #3483 as you've already found out, and no, that design is not intentional; I even believe my #3492 has fixed it.
Unfortunately, the inclusion of that patch hasn't been moving forward for a very specific reason: hierarchical config will introduce new attack vectors if one or serveral rust-toolchain.toml
files can't be trusted. Due to the limited bandwidth of the Rustup team, all relevant work is suspended until we come up with a solution to that issue before pushing the hierarchical config proposal forward again. At this point I'm as sad as you are, sorry 🙇
@polarathene OTOH I'm open to doc improvements, although I'm not sure if we're documenting a bug. Maybe calling it a limitation would be better.
If you can come up with a PR, I'll be glad to review it 🙏
TL;DR: I could adjust the docs.. however fixing the regression introduced (specifically to profile
support) instead may be fairly simple AFAIK? If that'd be acceptable, I don't mind contributing that instead?
Unfortunately, the inclusion of that patch hasn't been moving forward for a very specific reason: hierarchical config will introduce new attack vectors if one or serveral
rust-toolchain.toml
files can't be trusted
So to clarify:
rust-toolchain.toml
support with rustup, the setting profile
configured for rustup is ignored when this file is present and a toolchain is installed?rust-toolchain.toml
feature appears to have broken the global behaviour (as described in the original feature request), so this is technically a regression.Is it not possible to fix the regression introduced specifically with profile
?
minimal
, it should respect that when it's not present in rust-toolchain.toml
, as it previously did.I'd rather address that than correct the docs with the existing gotcha. If the contribution doesn't sound too troublesome and would get approval, I can give it a shot?
profile
is None
after parsing rust-toolchain.toml
, it just needs to additionally check for a profile
key in ~/.rustup/settings.toml
as a fallback?profile
configured for rustup?If the contribution doesn't sound too troublesome and would get approval, I can give it a shot?
@polarathene Wait, you reminded me of something. Maybe my #3492 can be carefully cherry-picked into two parts. I do remember some commits are related to rust-toolchain.toml
while others aren't.
So in theory you can use (or get inspired from) half of my PR (so without the rust-toolchain.toml
filesystem walk hierarchy part), make sure that the default
toolchain (incl. profile, channel, etc.) is working as you'd expect, add a bunch of smoke tests, adjust the docs accordingly (mentioning the limitations) and call it a day. The rest of that PR will be merged later...
As long as @rbtcollins agrees with that plan.
Anyway, that PR is on our v1.28 milestone (meaning we have to at least react to it in some way), so I'm not going anywhere.
Verification
Problem
In 2020Q4 support for installing a toolchain defined in
rust-toolchain.toml
with a new profile key was added to rustup: https://github.com/rust-lang/rustup/pull/2586While this works, when the
profile
key is not set, there is no fallback to the global profile setting for rustup. Thus ifrust-toolchain.toml
exists, despite rustup being configured for aminimal
profile, the toolchain will be downloaded with thedefault
profile bringing in over 600MB of HTML docs and additional components.This took a while to trackdown/confirm why the rustup profile wasn't being respected 😅 While a little surprising, I tried searching for any existing issues and came up empty.
Steps
minimal
.rust-toolchain.toml
file in an empty directory, with contents:cargo --version
, rustup will download the toolchain.minimal
profile:If you repeat these steps but add
profile = "minimal"
to therust-toolchain.toml
file with a different toolchain version, the HTML docs won't be present, theshare/
directory itself will now be about 500KB.Possible Solution(s)
profile
is not defined, use the rustup configured profile setting to align with installing a toolchain viarustup
explicitly.rust-toolchain.toml
without aprofile
key will not fallback to the global rustup profile, which can result in excessive disk usage.Notes
Past issues requesting the feature support prior to the 2020 PR:
Discussion regarding interoperability across config layers, including better documenting precedence:
Rustup version
Installed toolchains
OS version