-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
A-configurationArea: cargo config files and env varsArea: cargo config files and env varsC-bugCategory: bugCategory: bugS-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.
Description
Problem
Cargo will read from the current directory upwards (after resolving symlinks) and search for all .cargo/config.toml file. After that, it will read $CARGO_HOME/config.toml.
If $CARGO_HOME/config.toml was previously loaded, it is not loaded twice unless any directory in its location is a symlink.
Steps
on unix:
mkdir -p a/bln -s a cmkdir a/.cargoecho "[build]\nrustdocflags = [\"--default-theme=dark\"]" > a/.cargo/config.tomlcd a/bCARGO_HOME=../../c/.cargo cargo doc- notice (with
straceor by having a project ata/b) that the config file is read twice and the build fails
Possible Solution(s)
Cargo should also calculate the realpath of $CARGO_HOME/config.toml before comparing it to the current dir (for which the realpath is calculated).
Notes
No response
Version
cargo 1.89.0 (c24e10642 2025-06-23)
release: 1.89.0
commit-hash: c24e1064277fe51ab72011e2612e556ac56addf7
commit-date: 2025-06-23
host: x86_64-unknown-linux-gnu
libgit2: 1.9.0 (sys:0.20.2 vendored)
libcurl: 8.16.0 (sys:0.4.80+curl-8.12.1 system ssl:OpenSSL/3.6.0)
os: NixOS 25.11.0 [64-bit]
and
cargo 1.92.0-nightly (367fd9f21 2025-10-15)
release: 1.92.0-nightly
commit-hash: 367fd9f213750cd40317803dd0a5a3ce3f0c676d
commit-date: 2025-10-15
host: x86_64-unknown-linux-gnu
libgit2: 1.9.1 (sys:0.20.2 vendored)
libcurl: 8.15.0-DEV (sys:0.4.83+curl-8.15.0 vendored ssl:OpenSSL/3.5.4)
ssl: OpenSSL 3.5.4 30 Sep 2025
os: NixOS 25.11.0 [64-bit]
Metadata
Metadata
Assignees
Labels
A-configurationArea: cargo config files and env varsArea: cargo config files and env varsC-bugCategory: bugCategory: bugS-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.