Reproducible Builds: Make target/.fingerprint/.../dep-... dep-info files deterministic#16691
Reproducible Builds: Make target/.fingerprint/.../dep-... dep-info files deterministic#16691kpcyrd wants to merge 1 commit intorust-lang:masterfrom
Conversation
|
r? @ehuss rustbot has assigned @ehuss. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Note that our contrib process asks for people to create issues and get agreement before moving onto PRs. This might seem like a simple change and move straight onto a PR but the question is if it is the right change as changing data structures can have other impacts. |
|
@epage is it ok to have this discussion here or should I open an issue to discuss? :) |
|
fwiw I have a second patch that would make the If you run |
Awesome! It would be appreciated if we can have an issue listing your findings :) |
|
There can be many PR attempts for a topic, either becaus the contributor tries multiple ideas or multiple contributors make attempts over time, etc. Having one Issue consolidates the requirements gathering and design discussion rather than splitting the across multiple PRs. We're also more likely to search in Issues than PRs. |
What does this PR try to resolve?
When debugging unreproducible Rust binaries it's common to diff the build directory contents with something like:
I noticed there's files in
target/*/.fingerprint/that vary each time they are generated. This is because iterating over a HashMap causes the order to be undefined, when using a BTreeMap they are going to be sorted by key. Alternatively there could be an explicitsort()step.I'm not sure if this is actually a valid source of non-determinism in release binaries (I somewhat doubt this), but making the contents of this folder deterministic makes it easier to diff build directories.
How to test and review this PR?
There's two ways to test this:
target/*/.fingerprint/*/dep-*and note that all paths are in alphabetical orderWith my current cargo:
I get two different files:
Running diffoscope on those two files gives me this diff:
With my patch applied I now get identical files: