Subject: [bug#74296] [PATCH 1/1] guix: records: Fix abi check in cross compile context

From: Christoph Buck <[email-masked]>
Date: Sun, 10 Nov 2024 19:23:01 +0100

* guix/records.scm: Use 32bit hash value for abi check to prevent
`record-abi-mismatch-error` in a cross-compile context

Change-Id: I889747b1a2837bee8bf9b4de5729fdcf1b165380
---
 guix/records.scm | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/guix/records.scm b/guix/records.scm
index dca1e3c2e7..2084499e36 100644
--- a/guix/records.scm
+++ b/guix/records.scm
@@ -415,11 +415,13 @@ (define-syntax define-record-type*
       ;; list of symbols.
       (syntax-case field-specs ()
         (((field get properties ...) ...)
-         (string-hash (object->string
-                       (syntax->datum #'((field properties ...) ...)))
-                      (cond-expand
-                        (guile-3 (target-most-positive-fixnum))
-                        (else most-positive-fixnum))))))
+         (let ((hash-value
+                (string-hash
+                 (object->string (syntax->datum #'((field properties ...) ...))))))
+           (cond
+            ((< most-positive-fixnum (ash 1 32)) hash-value)
+            ((< most-positive-fixnum (ash 1 64)) (ash hash-value -32))
+            (else (error "unexpected!" most-positive-fixnum)))))))
 
     (syntax-case s ()
       ((_ type syntactic-ctor ctor pred
-- 
2.45.1