Repository navigation
build: sort the source list, so the link order is the same everywhere - #36
Merged
Merged
Conversation
The candidate sources come from seven find calls, unsorted, and the objects are linked in that order. find returns the directory order, which depends on how the checkout was made, so two checkouts of one commit built binaries with the same symbols in a different order and a different hash: a fresh clone and a cp -a copy of it were enough. Sorting the list bytewise makes the link order a function of the sources alone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes, and why
The candidate sources come from seven
findcalls, unsorted, and the objects are linked in that order.findreturns the directory order, which depends on how the checkout was made, so two checkouts of one commit built binaries with the same symbols in a different order and a different hash. A fresh clone and acp -acopy of it were enough. Sorting the list bytewise (LC_ALL=C sort) makes the link order a function of the sources alone, so a build can be checked against a recorded hash.Verification
cp -acopies of them. Both were built withbuild.shin one container image, withSOURCE_DATE_EPOCHpinned.5ffeb331…againstbd6e4cbb…, and simple_repeater5e3c0606…againstf8c96798….b5023b7c…, simple_repeaterd238be03….nm -S, sorted) are identical across all four builds of each role: 2,030 for the companion, 1,992 for the repeater. Only their order moved.There's no test in the tree for this: reproducing it needs two checkouts with different directory histories, which a unit test can't make. A CI job that builds twice, once from a copy of the checkout, and compares hashes would pin it; I've left that out of this change.
Reported in MeshBench/meshbench#809.