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)
Wed, Dec 4, 12:05 AM
Unknown Object (File)
Wed, Dec 4, 12:05 AM
Unknown Object (File)
Wed, Dec 4, 12:05 AM
Unknown Object (File)
Wed, Dec 4, 12:05 AM
Unknown Object (File)
Tue, Dec 3, 11:44 PM
Unknown Object (File)
Nov 19 2024, 3:18 PM
Unknown Object (File)
Oct 3 2024, 12:34 AM
Unknown Object (File)
Sep 24 2024, 4:33 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

Lint
Lint Skipped
Unit
Tests Skipped

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.