Don't read the config file twice when $CARGO_HOME is a symlink
What does this PR try to resolve?
Cargo should not load configuration twice if the config is symlinked
resolves #16206
How to test and review this PR?
Steps
on unix:
mkdir -p a/b
ln -s a c
mkdir a/.cargo
echo "[build]\nrustdocflags = [\"--default-theme=dark\"]" > a/.cargo/config.toml
cd a/b
CARGO_HOME=../../c/.cargo cargo docnotice (with
straceor by having a project ata/b) that the config file is read twice and the build fails
Note that a test should be added for this. We find it works best when a test is added in its own commit, showing the buggy behavior, and then put your fix on the commit after which will then update the test to show the fixed behavior.
r? @weihanglo
rustbot has assigned @weihanglo. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r? to explicitly pick a reviewer
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.
Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.
Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.