summary refs log tree commit diff
diff options
context:
space:
mode:
authorMathieu Othacehe <m.othacehe@gmail.com>2017-11-03 13:40:07 +0100
committerMathieu Othacehe <m.othacehe@gmail.com>2017-11-06 20:02:25 +0100
commitb1a30793477c705a136546798d8e1d27802dd4b7 (patch)
tree1e56c5072af10e1d3b1af7660bd8d171d7909882
parentdd208b936cb5618ae34bf2df416bf2c0c3a049c3 (diff)
downloadguix-b1a30793477c705a136546798d8e1d27802dd4b7.tar.gz
system: vm: Use 2^32 - 1 as hash size.
* gnu/system/vm.scm (operating-system-uuid): Use 2^32 - 1 instead of
  2^32 as hash size.

On some 32 bit system (ARM for example), 2^32 exceeds hash max
size (ULONG_MAX = 2^32 - 1).
-rw-r--r--gnu/system/vm.scm8
1 files changed, 4 insertions, 4 deletions
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 3127b305e1..44246083b3 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -372,13 +372,13 @@ TYPE (one of 'iso9660 or 'dce).  Return a UUID object."
       (bytevector->uuid
        (uint-list->bytevector
         (list (hash file-system-type
-                    (expt 2 32))
+                    (- (expt 2 32) 1))
               (hash (operating-system-host-name os)
-                    (expt 2 32))
+                    (- (expt 2 32) 1))
               (hash (operating-system-services os)
-                    (expt 2 32))
+                    (- (expt 2 32) 1))
               (hash (operating-system-file-systems os)
-                    (expt 2 32)))
+                    (- (expt 2 32) 1)))
         (endianness little)
         4)
        type)))