Skip to content

CARGO_RUSTC_CURRENT_DIR is causing forced rebuilds #14798

Open
@ehuss

Description

@ehuss

Problem

In the cargo repo, there is an environment override setting the CARGO_RUSTC_CURRENT_DIR environment variable:

[env]
# HACK: Until this is stabilized, `snapbox`s polyfill could get confused
# inside of the rust-lang/rust repo because it looks for the furthest-away `Cargo.toml`
CARGO_RUSTC_CURRENT_DIR = { value = "", relative = true }

This is causing testsuite to always be considered dirty on my system. I am getting:

FsStatusOutdated(StaleItem(ChangedEnv 
{ var: "CARGO_RUSTC_CURRENT_DIR", 
previous: Some("/Users/eric/Proj/rust/cargo"), 
current: Some("/Users/eric/Proj/rust/cargo/") 
}

Note the difference in trailing /

Steps

  1. Check out rust-lang/cargo
  2. cargo test --test testsuite --no-run
  3. cargo test --test testsuite --no-run -- This should build testsuite again.

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.84.0-nightly (031049782 2024-11-01)
release: 1.84.0-nightly
commit-hash: 0310497822a7a673a330a5dd068b7aaa579a265e
commit-date: 2024-11-01
host: aarch64-apple-darwin
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.7.1 (sys:0.4.74+curl-8.9.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Mac OS 14.6.1 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-documenting-cargo-itselfArea: Cargo's documentationA-environment-variablesArea: environment variablesA-rebuild-detectionArea: rebuild detection and fingerprintingC-bugCategory: bugS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions