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)
Fri, Dec 26, 4:02 PM
Unknown Object (File)
Nov 24 2025, 3:06 PM
Unknown Object (File)
Nov 23 2025, 6:48 AM
Unknown Object (File)
Nov 21 2025, 1:28 AM
Unknown Object (File)
Nov 21 2025, 1:22 AM
Unknown Object (File)
Nov 21 2025, 1:22 AM
Unknown Object (File)
Nov 21 2025, 1:20 AM
Unknown Object (File)
Nov 21 2025, 1:18 AM
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.