Subject: 30.1; [reproducibility] sysinfo call during profile dump

From: Nicolas Graves <[email-masked]>
Date: Wed, 23 Jul 2025 16:09:41 +0200

Hi emacs,

I recently worked a bit on reproducibility which is not guaranteed in
particular in the profile dump.  I found that undeterminism during the
profile dump comes from two sources : calls to clock_gettime and
sysinfo.

clock_gettime is not that hard to patch using faketime, but it's called
multiple times so it'll be harder to find where in the codebase.

We don't have dedicated tools to patch sysinfo without compiling an
additional file an using the same LD_PRELOAD trick as faketime, but
there's actually an OK solution on the lisp side, IMHO (this is what I
propose for guix's [email-masked], but it'd be great to add that on the next
release: 

(add-after 'unpack 'avoid-sysinfo-call-at-build-time
 (lambda _
  ;; This is a useful trick for reproducibility: when we configured
  ;; with --disable-build-details, (system-name) is nil at build
  ;; time on the lisp side.
  ;; Find those places with strace -k -e sysinfo.
  (substitute* "lisp/jit-lock.el"
    (("\\(condition-case nil \\(load-average\\) \\(error\\)\\)"
      all)
     (format #f "(and (system-name) ~a)" all)))))

It's only a single line change (with maybe a comment addition), please
proceed without my feedback if I don't answer, it doesn't deserve a
copyright citation.

-- 
Best regards,
Nicolas Graves