Skip to content

Commit 5fecb7b

Browse files
authored
Rollup merge of #155935 - paradoxicalguy:fix-out-dir-remap, r=Urgau,
remap OUT_DIR paths to fix build script path leakage in crate metadata. ### problem: - build script outputs (`OUT_DIR`) leak absolute paths into crate metadata causing non-determinism across identical builds. - bootstrap remaps source paths (`self.build.src`) and registry sources but doesn't not remap `self.build.out` used by `OUT_DIR` ### fix: - adding `--remap-path-prefix` for `self.build.out` , mapping it to a stable virtual prefix, consistent with existing remappings ### result: - removes path-based non-determinism from build script outputs - verified via stage 2 reproducibility testing. r? @Urgau
2 parents fbd3323 + 26ce8a9 commit 5fecb7b

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/bootstrap/src/core/builder/cargo.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,8 @@ impl Builder<'_> {
10731073
// rustc creates absolute paths (in part bc of the `rust-src` unremap
10741074
// and for working directory) so let's remap the build directory as well.
10751075
format!("{}={map_to}", self.build.src.display()),
1076+
// remap OUT_DIR so they don't leak into artifacts.
1077+
format!("{}={map_to}/out", self.build.out.display()),
10761078
]
10771079
.join("\t");
10781080
cargo.env("RUSTC_DEBUGINFO_MAP", map);
@@ -1093,6 +1095,8 @@ impl Builder<'_> {
10931095
// rustc creates absolute paths (in part bc of the `rust-src` unremap
10941096
// and for working directory) so let's remap the build directory as well.
10951097
format!("{}={map_to}", self.build.src.display()),
1098+
// remap OUT_DIR so they don't leak into artifacts.
1099+
format!("{}={map_to}/out", self.build.out.display()),
10961100
]
10971101
.join("\t");
10981102
cargo.env("RUSTC_DEBUGINFO_MAP", map);

0 commit comments

Comments
 (0)