Most of FreeBSD builds "reproducibly" (aka. with two builds producing identical binaries) but there are a few deviations from this. It would be great if these could be eliminated.

Known problem files in HEAD

/boot/{loader, pxeboot,, zfsloader}

Contain build time/date.


Contains time/date, user, and host. See

Kernel modules with full paths (in non-debug sections)

Reported by the Debian GNU/kFreeBSD folks. Specifying .PATH: $(.CURDIR)/foo/bar in a Makefile expands ${.CURDIR} to an absolute path. Debian used relative paths instead: .PATH foo/bar.


Filesystem image file produced by makefs(8) includes date or other metadata. makefs(8) uses random(3) for generation numbers in ffs and seeds srandom(3) with the system time.

Triage required

The build option survey (from phk@, recently resurrected by bz@) demonstrated possible non-reproducibility in a number of files unrelated to the option being tested - for example:

                usr/lib/debug/boot/kernel/aacraid.ko.debug file size=429288
                usr/lib/debug/boot/kernel/aacraid.ko.debug file size=429280
                usr/lib/debug/boot/kernel/acpi_asus.ko.debug file size=72032
                usr/lib/debug/boot/kernel/acpi_asus.ko.debug file size=72024
                usr/share/man/mandoc.db file size=5998592
                usr/share/man/mandoc.db file size=5997568
                usr/share/openssl/man/mandoc.db file size=174080
                usr/share/openssl/man/mandoc.db file size=171008

Failures appear to be none, one, or both of the .db files and a variety of different kernel module .debug files.

Possible solutions

The issue with mandoc.db is that mandoc uses each page's inode number as a hash key to avoid indexing the same page twice, then processes them in the order in which they are stored in the hash, which is (effectively) non-deterministic. The fix is to:

  1. provide fts_open() with a comparison function, which ensures that hard-linked pages are processed in a deterministic order;
  2. in addition to the hash, insert pages into a linked list, which by virtue of a. will be sorted;
  3. use the hash only for deduplication, and the linked list for iteration.

Resolved issues



Fix Revision


copyright year; now derived from src/COPYRIGHT (Previously the build year was placed in the Copyright statement. This isn't even valid since the passage of time doesn't create new copyrightable work.)



Build host and user (still contains the build OS name and version)



build date/time



contains the user and host names from the build



weird things happening here, even after time stamps were removed in r257129.

Fixed in an unknown revision.


contains the build date



contains user and host names, and the build time


ReproducibleBuilds (last edited 2016-06-22 10:11:10 by DagErlingSmørgrav)