Subject: Re: bug#26751: [PATCH v2] gnu: build: file-systems: Add ISO-9660.

From: [email-masked] (Ludovic Courtès)
Date: Tue, 02 May 2017 23:32:13 +0200

Danny Milosavljevic <[email-masked]> skribis:

> * gnu/build/file-systems.scm (iso9660-superblock?,
> read-iso9660-primary-volume-descriptor, read-iso9660-superblock,
> iso9660-superblock-uuid, iso9660-uuid->string,
> iso9660-superblock-volume-name): New variables.
> (%partition-label-readers): Add iso9660.
> (%partition-uuid-readers): Add iso9660.

[...]

> +(define (iso9660-superblock-uuid sblock)
> +  "Return the modification time of a iso9660 superblock SBLOCK as a bytevector."
> +  ;; FIXME Use only certain parts (See grub).
> +  ;; FIXME treat "all 0" as invalid.

Please expound these two comments, as discussed on guix-devel.

> +  ;; Drops GMT offset for compatibility with Grub, blkid and /dev/disk/by-uuid.
> +  ;; Compare Grub: "2014-12-02-19-30-23-00".
> +  ;; Compare blkid result: "2014-12-02-19-30-23-00".
> +  ;; Compare /dev/disk/by-uuid entry: "2014-12-02-19-30-23-00".
> +  (sub-bytevector sblock 830 16))
> +
> +(define (iso9660-uuid->string uuid)
> +  (define digits->string latin1->string)
> +  (let* ((year (sub-bytevector uuid 0 4))
> +         (month (sub-bytevector uuid 4 2))
> +         (day (sub-bytevector uuid 6 2))
> +         (hour (sub-bytevector uuid 8 2))
> +         (minute (sub-bytevector uuid 10 2))
> +         (second (sub-bytevector uuid 12 2))
> +         (hundreths (sub-bytevector uuid 14 2))
> +         (parts (list year month day hour minute second hundreths)))
> +    (string-append (string-join (map digits->string parts)))))

Neat!  Please add a docstring.

> +(define (iso9660-superblock-volume-name sblock)
> +  "Return the volume name of SBLOCK as a string.  The volume name is an ASCII
> +string.  Trailing spaces are trimmed."
> +  (string-trim-right (latin1->string (sub-bytevector sblock 40 32) (lambda (c) #f)) #\space))

Please trim to 80 columns.  :-)

OK with these changes, thank you!

Ludo’.