GNU bug report logs - #55792
[PATCH 0/3 maintenance] Web site at 10years.guix.gnu.org

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Sat, 4 Jun 2022 08:37:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: 55792 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: [bug#55792] [PATCH 3/3] hydra: web: Make mcron job derivations deterministic.
Date: Sat,  4 Jun 2022 10:37:36 +0200
The result of (hash config period) varies between runs.  Thus, starting
from bdb914a1242cb0c00957050c96d1e279d2eb5dec, each run of "guix system
build -d ..." would produce a different derivation.

This commit fixes that.

* hydra/modules/sysadmin/web.scm (static-web-site-mcron-jobs)[record->list]:
New procedure.
Use it.
---
 hydra/modules/sysadmin/web.scm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/hydra/modules/sysadmin/web.scm b/hydra/modules/sysadmin/web.scm
index e04ac1b..f26ed24 100644
--- a/hydra/modules/sysadmin/web.scm
+++ b/hydra/modules/sysadmin/web.scm
@@ -179,11 +179,19 @@ that's built with Haunt or similar."
                            (basename
                             (static-web-site-configuration-directory config)))))
 
+  (define (record->list record)
+    (let ((fields (record-type-fields <static-web-site-configuration>)))
+      (map (lambda (n)
+             (struct-ref record n))
+           (iota (length fields)))))
+
   (map (lambda (config)
          ;; Add an offset to spread web site updates over the period to avoid I/O
-         ;; load peaks when there are several such jobs.
+         ;; load peaks when there are several such jobs.  Compute a hash over
+         ;; a list representation of CONFIG, rather than over CONFIG, because
+         ;; hash of a struct depends on the object identity of its vtable.
          (let* ((period (static-web-site-configuration-period config))
-                (offset (hash config period)))
+                (offset (hash (record->list config) period)))
            #~(job (lambda (now)
                     (let ((elapsed (modulo now #$period)))
                       (+ now (- #$period elapsed) #$offset)))
-- 
2.36.1





This bug report was last modified 3 years and 44 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.