Skip to content

fix: remap bootstrap source paths in rustc - #53

Merged
dzbarsky merged 1 commit into
mainfrom
codex/bootstrap-direct-remap-args
Sep 5, 2026
Merged

dzbarsky merged 1 commit into
mainfrom
codex/bootstrap-direct-remap-args

Conversation

@dzbarsky

@dzbarsky dzbarsky commented Sep 5, 2026

Copy link
Copy Markdown
Member

Bootstrap actions put rustc flags in @params, but bootstrap_process_wrapper substitutes only direct arguments. The literal remap placeholders leave execution directories in bootstrap tinyjson metadata, even with debug information stripped. Use -Zremap-cwd-prefix=. for bootstrap compilation so rustc resolves its own working directory, defaulting RUSTC_BOOTSTRAP to the bootstrap crate's name and preserving explicit environment settings.

Keep the existing bootstrap response files: _spawnvp does not preserve embedded quotes in direct Windows arguments. The C++ wrapper and its macOS SDKROOT expansion remain unchanged. This is an alternative to #46.

Validation on macOS arm64 with Bazel 9.1.0 and Rust 1.98.0: the new test reads the actual bootstrap tinyjson archive and fails before the fix. Sandboxed and local builds in different output bases now produce identical archives without execution-directory strings. bazel test //...: 621 passed, 37 skipped.

Refs hermeticbuild/rules_rs#233.

-zbarskybot

Bootstrap actions pass rustc flags through @params, but the C++ bootstrap
process wrapper substitutes only direct arguments. The literal remap
placeholders leave execution directories in tinyjson crate metadata.

Use -Zremap-cwd-prefix for bootstrap compilation so rustc resolves its own
working directory. Default RUSTC_BOOTSTRAP to the bootstrap crate's name,
preserving explicit environment settings. Keep the existing response files
and SDKROOT expansion without changing the C++ wrapper.

Add a regression test that reads the actual bootstrap tinyjson archive.
The test fails before the fix. Sandboxed and local builds in different
output bases now produce identical archives without execution directories.
Validation: Bazel 9.1.0, Rust 1.98.0, macOS arm64; bazel test //... passed
621 tests and skipped 37 platform-incompatible tests.

Refs hermeticbuild/rules_rs#233 and #46.

Co-authored-by: Codex <noreply@openai.com>
@dzbarsky
dzbarsky force-pushed the codex/bootstrap-direct-remap-args branch from 77ca3ca to 241e184 Compare September 5, 2026 18:57
@dzbarsky dzbarsky changed the title fix: keep bootstrap remap flags outside response files fix: remap bootstrap source paths in rustc Sep 5, 2026
@dzbarsky
dzbarsky merged commit e9dd49f into main Sep 5, 2026
3 checks passed
dzbarsky added a commit to hermeticbuild/rules_rs that referenced this pull request Sep 5, 2026
Update the rules_rust pin to source release e9dd49f22cfa43c75ba30cd9d9bb7d8bdc459dde, including the bootstrap reproducibility fix in hermeticbuild/rules_rust#53. Update bundled Ubuntu Noble zlib1g to 1.3.dfsg-3.1ubuntu2.2 for amd64 and arm64, retaining immutable snapshot URLs at 20260901T000000Z.

Select empty_allocator_libraries for target_triple_constraints_test. This test analyzes every target triple with an empty standard library and builds only a marker file; the new default allocator dependency otherwise requires a linker for these synthetic configurations.

Validation: all 48 root tests and target_triple_constraints_test passed on macOS with Bazel 9.1.0. Verified the source archive SHA-256 and bootstrap fix. Downloaded both zlib packages, matched their hashes against Ubuntu's snapshot package index, and checked the expected shared-library files. Buildifier and git diff --check pass.

Refs #243 and #233.

All ten CI checks passed on Linux and Windows with Bazel 8 and 9.

Co-authored-by: Codex <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant