summary refs log tree commit diff
path: root/gnu/system
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <me@tobias.gr>2023-06-18 02:00:00 +0200
committerTobias Geerinckx-Rice <me@tobias.gr>2023-06-18 02:00:10 +0200
commit65ed7a61f1ad01da440f0e7e08bfc32b43deed73 (patch)
treeb8128aff0aa98bf0dac91b443fdf060c4fff26f2 /gnu/system
parent2e0228e736bf08d376ffbce6b5c4f899babfee5e (diff)
downloadguix-65ed7a61f1ad01da440f0e7e08bfc32b43deed73.tar.gz
uuid: Fix NTFS UUID stringification.
Previously, (ntfs-uuid->string (string->ntfs-uuid"5234ED0D34ECF53F"))
would yield "5234EDD34ECF53F".

Reported by sughosha in #guix.

* gnu/system/uuid.scm (ntfs-uuid->string): Pad hex bytes with zero when
needed.
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/uuid.scm2
1 files changed, 1 insertions, 1 deletions
diff --git a/gnu/system/uuid.scm b/gnu/system/uuid.scm
index a95dc1b7d1..8f967387ad 100644
--- a/gnu/system/uuid.scm
+++ b/gnu/system/uuid.scm
@@ -209,7 +209,7 @@ ISO9660 UUID representation."
 
 (define (ntfs-uuid->string uuid)
   "Convert NTFS UUID, a 8-byte bytevector, to its string representation."
-  (format #f "~{~:@(~x~)~}" (reverse (bytevector->u8-list uuid))))
+  (format #f "~{~:@(~2,'0x~)~}" (reverse (bytevector->u8-list uuid))))
 
 (define %ntfs-uuid-rx
   (make-regexp "^([[:xdigit:]]{16})$"))