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)
Jan 6 2024, 10:38 AM
Unknown Object (File)
Dec 25 2023, 3:03 AM
Unknown Object (File)
Dec 23 2023, 10:28 AM
Unknown Object (File)
Nov 2 2023, 5:02 AM
Unknown Object (File)
Aug 27 2023, 6:46 AM
Unknown Object (File)
Aug 15 2023, 12:15 AM
Unknown Object (File)
Aug 12 2023, 9:16 PM
Unknown Object (File)
Jul 4 2023, 12:18 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.