Bug 234152 - libpmc does not build reproducibly
Summary: libpmc does not build reproducibly
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.0-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2018-12-19 02:30 UTC by Ed Maste
Modified: 2018-12-20 14:48 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer 2018-12-19 02:30:21 UTC
For some reason libpmc_events.c is generated with structs in a different order:

On my laptop:

% wc obj/libpmc_events.c    
   68563  386042 2990918 obj/libpmc_events.c
% head -n 5 obj/libpmc_events.c
#include "pmu-events/pmu-events.h"
static struct pmu_event pme_ivybridge[] = {
        .name = "cpl_cycles.ring0",
        .event = "umask=0x1,period=2000003,event=0x5c",
% sort obj/libpmc_events.c | sha256

On universe11b:

% wc ./lib/libpmc/libpmc_events.c  
   68563  386042 2990918 ./lib/libpmc/libpmc_events.c
% head -n 5 ./lib/libpmc/libpmc_events.c
#include "pmu-events/pmu-events.h"
static struct pmu_event pme_westmereep_dp[] = {
        .name = "dtlb_load_misses.any",
        .event = "umask=0x1,period=200000,event=0x8",
% sort ./lib/libpmc/libpmc_events.c | sha256
Comment 1 Ed Maste freebsd_committer 2018-12-20 14:48:23 UTC
mmacy tracked this to jevents.c's use of nftw(3) which traverses in filesystem order. nftw uses fts(3) internally but there is unfortunately no way to have it sort entries. There was a suggestion of a flag extension to POSIX (e.g. FTW_SORT) to have nftw pass a comparison function to fts_open.