unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#29132] [PATCH] system: vm: Use 2^32 - 1 as hash size.
@ 2017-11-03 12:49 Mathieu Othacehe
  2017-11-05 20:48 ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Mathieu Othacehe @ 2017-11-03 12:49 UTC (permalink / raw)
  To: 29132

* 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).
---
 gnu/system/vm.scm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 3127b30..4424608 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)))
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-06 19:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-03 12:49 [bug#29132] [PATCH] system: vm: Use 2^32 - 1 as hash size Mathieu Othacehe
2017-11-05 20:48 ` Ludovic Courtès
2017-11-05 20:56   ` Mathieu Othacehe
2017-11-06  8:41     ` Ludovic Courtès
2017-11-06 19:04       ` Mathieu Othacehe

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).