Conversation
|
Fixed a minor CI/CD problem on Windows. |
|
About Windows' bin directory location problem, here's more context:
@ChrisDenton @rami3l , Current PR's defaulting to use |
|
Hm, since I feel one of the points of this feature is to use more platform native paths, I don't think I think either of the other two options are justifiable. Putting it under "Programs" is the most technically correct I guess but if anything there's a weaker precedent for that, albeit applications that used to support XP wouldn't have used it because "Programs" wasn't a thing back then. |
|
What are we doing for macOS here? The XDG stuff definitely doesn't feel native for it. |
|
There appears to be a fairly strong use of XDG for macOS cli utilities. I cannot find any officially documented conventions that aren't intended for app bundles but unofficially almost everything in the shell seems to treat it as a Unix (which it is). |
That's what @rami3l and I wants as well. |
|
In terms of precedence of different configuration options, as I have discussed with @Cloud0310, the only remaining concern is what to do when As per the previous summary in https://blog.rust-lang.org/inside-rust/2025/10/01/this-development-cycle-in-cargo-1.90/#all-hands-xdg-paths:
This means
|
AFAIK the standard library currently uses the same logic for macOS and Linux, so I think that is a very good default to start with: https://doc.rust-lang.org/stable/std/os/unix/xdg/fn.cache_home_dir.html Also, this is the convention followed by other existing tools such as neovim and uv. I am aware of the frequently-quoted macOS documentation page which to some may suggest paths like I would again point out (as @ChrisDenton has mentioned above) that these guidelines are specific to app bundles (that page is full of app bundle-specific paths, with If the user really prefers to place stuff in |
This also has an effect on the env var recursive forwarding system, I guess once we're in new mode, I need to stop forwarding |
@Cloud0310 Exactly, and I'd like to see more regression tests on this point to make sure that we have done the right thing. |
|
For macOS, I'm particularly concerned about the cache directories. If we don't put them in the location that the OS understands, we basically don't get to benefit from the OS managing caches, which seems bad. For binaries, won't it cause issues if we share a |
@djc What potential issues do you have in mind to be precise?
I am aware of special macOS mechanisms that may force the shrinking of |
@epage what's cargo's decision here? Maybe we want to sync this "favor" choice with cargo team. |
|
@epage Note that we are not pressuring cargo to do the final decision because in the opt-in period we can still change the default value, but it'd be interesting to see if we can land on something in common first. @Cloud0310 For Windows’ bin dir my personal preference would be the option 2 (PNPM) above. |
|
I think the commit history here could stand to be improved. Would suggest:
|
Untill we finally out of opt-in period and settle on this choice, I would just keep using |
This comment has been minimized.
This comment has been minimized.
445ebaf to
5108cf3
Compare
|
Self reviewed and checked again, also changed the resolution order as comment. And as for the forwarding system, I added extra conditions for making sure backward compatibility. |
5108cf3 to
469f34e
Compare
@Cloud0310 Make sure you do a proper backup of the current state of the work, but at this point given that the It should be noted however, that this comment is purely about new APIs that in the original plan would be upstreamed to |
469f34e to
04ffda3
Compare
04ffda3 to
cf31a84
Compare
| #[cfg(any(unix, test))] | ||
| pub(crate) fn rustup_env_home(&self) -> io::Result<PathBuf> { | ||
| if self.use_category_home() { | ||
| home::category_home(home::HomeCategory::Config, self) |
There was a problem hiding this comment.
Could we place this elsewhere? Something like $<category>_home/env/, not sure if <category> should be data or config... Personally I'd prefer data.
Maybe we can look for prior art in this field, if any?
There was a problem hiding this comment.
Searched for prior arts, the most relavent case to this is GHCup, they are using $XDG_DATA_HOME/ghcup/env, defaulting to ~/.local/share/ghcup/env
And for uv, they're using .local/bin/env for this purpose, which is causing colllision with slurm as reported.
|
Updated PR description, two open question is solved, and we have a new problem: Personally, I would love to remove this later, as we're defaultly modifying profiles and |
cf31a84 to
f360f28
Compare
Generate shell source commands and environment scripts with absolute paths. Keep historical command formatting independent of new output. Recognize current and historical commands during installation and uninstallation, preserving existing setup and removing matching lines.
Use the resolved bin home for installation, proxies, self-update, and child process PATH entries. Write and source environment scripts from the resolved env home. Verify absolute shell paths with split homes located beneath HOME.
Remove the legacy rustup home dependency from Cfg and use the resolved category homes instead. Preserve resolved RUSTUP_HOME and CARGO_HOME forwarding in legacy mode. In category mode, leave RUSTUP_HOME inherited and only resolve and forward an explicitly non-empty CARGO_HOME.
Remove rustup-managed binaries from both bin directories, preserving unrelated tools and removing directories only when empty. Clean Unix shell entries before deleting their home directories. On Windows, remove PATH entries for deleted bin directories unless --no-modify-path is set.
f360f28 to
7a98d0f
Compare
Related to #247.
Summary
Rustup historically stores configuration, state, data, and caches under a single
RUSTUP_HOME(defaulting to$HOME/.rustup).This prevents rustup from adhering to platform-standard directories (XDG on Unix, Known Folders on Windows).
This PR introduces an opt-in category-home layout guarded by
RUSTUP_USE_CATEGORY_HOME, while preserving the legacy single-directory layout by default.When category mode is enabled (
RUSTUP_USE_CATEGORY_HOME=1or any non-empty value other than"0"):downloads/,tmp/,update-hashes/$XDG_CACHE_HOME/rustupor~/.cache/rustupsettings.toml$XDG_CONFIG_HOME/rustupor~/.config/rustuptoolchains/,fallback/$XDG_DATA_HOME/rustupor~/.local/share/rustupstate.toml$XDG_STATE_HOME/rustupor~/.local/state/rustuprustc,cargo, etc.)~/.local/binWindows:
%USERPROFILE%/.local/bin(tentative)Important
Why gated?
Gating both category overrides and platform defaults avoids split-brain installations where external tools (e.g. older
rust-analyzer) still look exclusively inRUSTUP_HOMEfor toolchains.Resolution Precedence
Note
This order still needs discussion, upon whether we should consider
RUSTUP_HOMEandCARGO_HOME. See open questions.Design Guidance
We consider this as a breaking change, and
RUSTUP_HOMEas a purely legacy envvar, so in new mode, we don't use it anymore, so, on category mode available,
the fallback paths are ignored.
Categories (Cache / Config / Data / State)
RUSTUP_<CATEGORY>_HOME(if category mode is enabled)RUSTUP_HOME(legacy shared override)$HOME/.rustup(legacy fallback)Note
On Unix, explicit absolute
XDG_variables take precedence over$HOME-derived paths. Empty or relative XDG values are ignored.Windows does not consult XDG variables.
Bin Directory
RUSTUP_BIN_HOME(if category mode is enabled)~/.local/bin)$CARGO_HOME/bin$HOME/.cargo/binImportant Commits
feat(home): resolve category homes
Implements the core path resolution logic structured for future
homecrate compatibility across three layers:homecrate facade (mod home): Re-exports standardhomeAPIs, implementsRUSTUP_<CATEGORY>_HOMEresolution andRUSTUP_HOMEfallback without rollout logic.RUSTUP_USE_CATEGORY_HOME.feat(uninstall): remove legacy and category rustup homes
Removes rustup home directories (config, cache, data, state) for both legacy and category layouts. (Excludes bin directory).
feat(uninstall): clean legacy and category cargo bin homes
Cleans up rustup-managed proxy binaries and symlinks across both legacy and category bin directories, leaving unrelated user binaries untouched.
feat(installer): migrate bin and env paths to split homes
Completes the installer-side migration from Cargo-owned paths to Rustup's resolved homes. In category mode, rustup binaries, proxy links, self-update artifacts, executable checks, and child-process
PATHsetup now userustup_bin_home, while generated shell environment scripts use the config home throughrustup_env_home. Legacy mode preserves the existing$CARGO_HOMElayout.The commit also updates shell profile integration, Windows
PATHhandling, installer messages, and end-to-end coverage for the split layout.Open Questions
%USERPROFILE%/.local/bin. Needs community consensus on whether this is the appropriate platform default for Windows.PATHprecedence and migration UX from%USERPROFILE%\.cargo\bin.Following tasks
rustup migration category-mode, forcreating symlinks in legacy dir, pointing to coorresponding category dirs.