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

$CARGO_HOME/.cargo/config.toml does not respect XDG specifications #13928

Closed
DaniD3v opened this issue May 18, 2024 · 2 comments
Closed

$CARGO_HOME/.cargo/config.toml does not respect XDG specifications #13928

DaniD3v opened this issue May 18, 2024 · 2 comments
Labels
A-caching Area: caching of dependencies, repositories, and build artifacts A-configuration Area: cargo config files and env vars C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@DaniD3v
Copy link

DaniD3v commented May 18, 2024

Problem

Title.

Cargo should not clutter my home directory. Data should go into $XDG_STATE_HOME and config files should be (read-only!) from $XDG_CONFIG_HOME

Steps

  1. cd
  2. ls -a
  3. be annoyed about the .cargo and .rustup folders

Possible Solution(s)

Solution: changing the default paths and adding another path to this priority queue
image
I'd suggest we insert the XDG compliant paths above the current $CARGO_HOME/config.toml

The more difficult part about this is probably splitting the CARGO_HOME into 2 different paths.

There's 2 rust libraries implementing the XDG specifications:
directories-rs (cross-platform)
rust-xdg (linux-only)

This would not be a breaking change as you can still use the old location if there's already data there.
I assume this should only require changing a few paths. I could PR this myself if someone could pinpoint me to the code where the configs are read. I already did a repo-wide search but couldn't find anything referencing the path.

Notes

Read the full XDG specifications here: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

This would also resolve #11267

Version

cargo 1.80.0-nightly (4de0094ac 2024-05-09)
release: 1.80.0-nightly
commit-hash: 4de0094ac78743d2c8ff682489e35c8a7cafe8e4
commit-date: 2024-05-09
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: NixOS 23.11.0 [64-bit]
@DaniD3v DaniD3v added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels May 18, 2024
@weihanglo
Copy link
Member

Thanks for the report! The issue is probably a duplicate of #1734, and the proposed solution has been discussed in https://internals.rust-lang.org/t/pre-rfc-split-cargo-home (and still ongoing though a bit stale).

@DaniD3v
Copy link
Author

DaniD3v commented May 18, 2024

oh looks like doing that is quite a bit more complicated than I originally thought. I'll close this issue

@DaniD3v DaniD3v closed this as completed May 18, 2024
@weihanglo weihanglo added A-configuration Area: cargo config files and env vars A-caching Area: caching of dependencies, repositories, and build artifacts labels May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-caching Area: caching of dependencies, repositories, and build artifacts A-configuration Area: cargo config files and env vars C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants