Repository navigation
Make PHAR builds reproducible regardless of the file system - #117
Merged
Merged
Conversation
… depend on the order of directory entries
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.
Projects that distribute their software as a PHAR built with
phpab --pharincreasingly want their builds to be reproducible: building the same source code with the same tools should produce a PHAR that is identical bit for bit, no matter who builds it or on which machine. This is what allows users and third parties to independently confirm that a published PHAR really corresponds to the source code it claims to be built from, and it is a building block for supply-chain security practices such as SLSA build provenance.Until now,
phpab --pharadded files to the PHAR in whatever order the file system returned them. That order is not defined and differs between file systems and operating systems, for example between macOS and Linux, or between a developer's machine and a CI runner. Building the same input in two different environments could therefore result in two different PHARs, even though their contents were the same.With this change, files are always added to the PHAR in the same, well-defined order. Building the same input produces the same PHAR, independent of the file system it is built on.
There is no change in functionality: the generated PHARs contain the same files and behave exactly as before. Only the order of the entries inside the archive is now deterministic.