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.
This commit is contained in:
Tobias Geerinckx-Rice 2023-06-18 02:00:00 +02:00
parent 2e0228e736
commit 65ed7a61f1
No known key found for this signature in database
GPG key ID: 0DB0FF884F556D79

View file

@ -209,7 +209,7 @@ (define-syntax %ntfs-endianness
(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})$"))