Page MenuHomeFreeBSD

Sort pkgbase mtree metadata, for reproducible builds
ClosedPublic

Authored by emaste on Nov 15 2017, 1:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 19, 3:18 PM
Unknown Object (File)
Oct 3 2024, 12:34 AM
Unknown Object (File)
Sep 24 2024, 4:33 AM
Unknown Object (File)
Sep 8 2024, 7:25 AM
Unknown Object (File)
Sep 7 2024, 10:20 PM
Unknown Object (File)
Sep 7 2024, 9:45 PM
Unknown Object (File)
Sep 7 2024, 1:01 PM
Unknown Object (File)
Aug 27 2024, 2:41 PM
Subscribers

Details

Summary

Packaged base packages are created by running the stageworld and stagekernel targets with -DNO_ROOT, and converting the resulting mtree file into a set of pkg plists. If stage* is run with multiple processes the order of entries in the mtree file may be nondeterministic, and the resulting package tbz also had nondeterministic file ordering.

The mtree file generated by -DNO_ROOT builds consists of one line per file, with the filename starting in the first column, so is easily sorted. There's one exception: the first line of the mtree file is a comment, but the # character sorts before the filenames anyhow and needs no special treatment.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

You should enforce a locale for sort to produce a consistent output! either LC_COLLATE=C or anything (imho the best is LC_COLLATE=C)

In D13103#272413, @bapt wrote:

You should enforce a locale for sort to produce a consistent output! either LC_COLLATE=C or anything (imho the best is LC_COLLATE=C)

Maybe env -i LC_COLLATE=C sort ?

  • fix stray ; \
  • add explicit LC_COLLATE=C per @bapt suggestion
This revision is now accepted and ready to land.Nov 15 2017, 2:47 PM
This revision was automatically updated to reflect the committed changes.