File Order in a Reproducible Archive

An archive can encode a member sequence in addition to member bytes and metadata. Directory traversal order should therefore be intentional.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace two candidate builds
  2. Test the promised equality
  3. Inspect entry order separately from order inside files
  4. Identify what the reproducibility claim includes

Trace two candidate builds

One execution reads b then a and another reads a then b. Both archives can unpack to equal files, while their bytes differ. Stable directory processing helps control that variation.

Test the promised equality

Compare archive bytes when reproducibility requires the same binary identity. Compare decoded members where metadata differences are allowed. Lossless round trips distinguish these objectives.[1]

Inspect entry order separately from order inside files

Two builds can package identical files in different traversal order. An archive format can record order, timestamp and permission metadata in its bytes. Sorting entries and fixing other intended metadata rules can make comparisons meaningful. See stable file enumeration.

Build 1 entries A,B,C
Build 2 entries C,A,B
Extracted file contents may match
Archive byte digests can differ

Identify what the reproducibility claim includes

If metadata must reflect source permissions, preserve those intentionally. If archive identity should be independent of creation time, control timestamps. Compare entry lists and metadata as well as compressed bytes when debugging.

References

  1. Free Software Foundation, GNU Make Manual ↩