-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Add repro-check tool for verifying reproducible Rust builds #149888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
|
rustbot has assigned @Mark-Simulacrum. Use |
This comment has been minimized.
This comment has been minimized.
|
r? kobzol Thank you for working on this! I will take a look, and also nominate this for the next t-infra meeting. |
Add a new host tool that checks whether Rust builds are reproducible. It builds the stage-2 toolchain (or a full distribution) twice in separate workspaces and compares the resulting sysroots byte-for-byte using SHA-256. Differences are reported in an HTML file. The tool writes a minimal deterministic `bootstrap.toml` for each build, hashes files in parallel with Rayon, and supports the usual flags (`--jobs`, `--exclude-pattern`, `--path-delta`, `--full-dist`, etc.). Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
991e584 to
15a887f
Compare
|
We discussed this at our infra meeting, and we're unsure of who should maintain this tool, and if we have enough interest in fixing repro bugs, if they appear. Continuing the discussion on compiler stream on Zulip. We think that it might make sense to merge such a tool and keep it in for some time, to see if it finds any issues, and if we have someone to actually go and try to fix such issues. And then we can evaluate later if its maintenance costs offset the gains. |
Thanks for the discussion and for considering this. I agree with treating repro-check as an experimental tool initially. The goal from my side is to help surface reproducibility issues and provide a concrete way to compare builds. While I’m not a deep Rust compiler expert, I’m happy to help with using the tool for investigation, analyzing CI reports, narrowing down differences, and collaborating with the relevant teams when issues are found. I’m also fine with revisiting or adjusting the tool if the maintenance cost turns out to be too high. I’ll follow the discussion on the compiler stream on Zulip as well. Thanks again! |
This patch introduces a new host tool called repro-check that helps verify whether Rust compiler builds are reproducible.
Summary:
-> Builds the stage-2 Rust toolchain (or a full distribution) twice in separate workspaces.
-> Compares the resulting sysroots byte-for-byte using SHA-256.
-> Generates a detailed HTML report highlighting mismatches and ignored files.
-> Writes a deterministic bootstrap.toml for each build to ensure consistent settings.
-> Supports parallel hashing via Rayon.
-> Accepts standard options such as:
--jobs – Number of parallel jobs
--exclude-pattern – Ignore files matching a pattern
--path-delta – Adds extra directory levels to second build for path-sensitivity testing
--full-dist – Build full distribution instead of stage 2
--clean – Start from a clean workspace
--skip-copy – Reuse existing workspace without copying source
--verbose – Print detailed logging
Included components:
-> src/tools/repro-check/ – Tool source code (main.rs, build.rs, compare.rs, fs_utils.rs, config.rs)
-> Integration tests for hash computation, mismatch detection, ignored patterns, and case-insensitive handling.
-> Updates to Cargo.toml and Cargo.lock to include repro-check dependencies.
-> Bootstrap and builder updates to register the new tool.
References:
Tracking issues: #139793, #134589, #144669
Usage:
Build the tool
./x.py build src/tools/repro-check
Run (stage2 only, host target)
./build/x86_64-unknown-linux-gnu/stage1-tools-bin/repro-check
Full distribution with custom options
./build/x86_64-unknown-linux-gnu/stage1-tools-bin/repro-check
--jobs 16
--exclude-pattern .so
--path-delta 10
--html-output my-report.html