- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.7k
Description
Problem
I want to be able to run cargo 1.31 and have it respect my ,.cargo/config.
There seems to be no way to achieve this without causing recent cargo to issue a warning.
Steps
- Try: configis a file,config.tomldoesn't exist
warning: `/home/rustcargo/.cargo/config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
(Note that the phrase "symlink X to Y" is ambiguous. Does it mean make X a symlink to Y, or vice versa?)
- Try: configis a file;config.tomlis a symlink to it
warning: both `/home/rustcargo/.cargo/config` and `/home/rustcargo/.cargo/config.toml` exist. Using `/home/rustcargo/.cargo/config`
- Try config.tomlis a file,configis a symlink to it
warning: both `/home/rustcargo/.cargo/config` and `/home/rustcargo/.cargo/config.toml` exist. Using `/home/rustcargo/.cargo/config`
Possible Solution(s)
Check to see if one of the files is a link to the other. If so, don't issue the warning about both files existing.
The "one file is a link to the other" check should be done with stat and comparing st_dev and st_ino.  (AIUI Windows doesn't have symlinks in the same way so we don't need to do this check there.)
Notes
This is a blocker for me upgrading the pinned nightly used by CI tests for derive-deftly, because I have UI tests that check for the precise stderr output. Right now, those tests always produce polluted output in my local environment.
This is happening to me with  +nightly-2024-03-14.  I can't easily try a more recent version because my rustup is completely broken due to rust-lang/rustup#3737
Version
rustcargo@zealot:~/.cargo$ cargo -vV
cargo 1.77.0-beta.5 (837c09f04 2024-02-16)
release: 1.77.0-beta.5
commit-hash: 837c09f04022352c26cf445f37492709922b24ef
commit-date: 2024-02-16
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.2 vendored)
libcurl: 8.5.0-DEV (sys:0.4.70+curl-8.5.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Debian 10 (buster) [64-bit]
rustcargo@zealot:~/.cargo$