Skip to content

Conversation

@windsunil
Copy link

@windsunil windsunil commented Dec 11, 2025

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

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.).

Refs rust-lang#139793, rust-lang#134589, rust-lang#144669.

Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
@rustbot
Copy link
Collaborator

rustbot commented Dec 11, 2025

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Dec 11, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 11, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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

@rustbot
Copy link
Collaborator

rustbot commented Dec 11, 2025

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants