[PATCH] file-systems: Use creation time if modification time is unset for ISO9660.

  • Done
  • quality assurance status badge
Details
2 participants
  • Danny Milosavljevic
  • Ludovic Courtès
Owner
unassigned
Submitted by
Danny Milosavljevic
Severity
normal

Debbugs page

Danny Milosavljevic wrote 8 years ago
(address . guix-patches@gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20170606085037.28353-1-dannym@scratchpost.org
* gnu/build/file-systems.scm (iso9660-superblock-uuid): Modify.
---
gnu/build/file-systems.scm | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

Toggle diff (25 lines)
diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 10be0dc83..7737de3d0 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -268,12 +268,18 @@ as a bytevector, or #f if DEVICE does not contain an iso9660 file system."
(define (iso9660-superblock-uuid sblock)
"Return the modification time of an iso9660 primary volume descriptor
-SBLOCK as a bytevector."
+SBLOCK as a bytevector. If that's not set, returns the creation time."
;; 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))
+ (let* ((creation-time (sub-bytevector sblock 813 17))
+ (modification-time (sub-bytevector sblock 830 17))
+ (unset-time (make-bytevector 17 0))
+ (time (if (bytevector=? unset-time modification-time)
+ creation-time
+ modification-time)))
+ (sub-bytevector time 0 16))) ; strips GMT offset.
(define (iso9660-uuid->string uuid)
"Given an UUID bytevector, return its timestamp string."
Ludovic Courtès wrote 8 years ago
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 27265@debbugs.gnu.org)
87o9u066wp.fsf@gnu.org
Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (28 lines)
> * gnu/build/file-systems.scm (iso9660-superblock-uuid): Modify.
> ---
> gnu/build/file-systems.scm | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
> index 10be0dc83..7737de3d0 100644
> --- a/gnu/build/file-systems.scm
> +++ b/gnu/build/file-systems.scm
> @@ -268,12 +268,18 @@ as a bytevector, or #f if DEVICE does not contain an iso9660 file system."
>
> (define (iso9660-superblock-uuid sblock)
> "Return the modification time of an iso9660 primary volume descriptor
> -SBLOCK as a bytevector."
> +SBLOCK as a bytevector. If that's not set, returns the creation time."
> ;; 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))
> + (let* ((creation-time (sub-bytevector sblock 813 17))
> + (modification-time (sub-bytevector sblock 830 17))
> + (unset-time (make-bytevector 17 0))
> + (time (if (bytevector=? unset-time modification-time)
> + creation-time
> + modification-time)))
> + (sub-bytevector time 0 16))) ; strips GMT offset.

LGTM.

I suppose this makes those UUIDs a bit more unique, right?

Thank you,
Ludo’.
Danny Milosavljevic wrote 8 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 27265-done@debbugs.gnu.org)
20170607083534.0444685a@scratchpost.org
Hi Ludo,

On Wed, 07 Jun 2017 01:19:34 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

Toggle quote (4 lines)
> LGTM.
>
> I suppose this makes those UUIDs a bit more unique, right?

Yes, and it also aligns with what util-linux libblkid is doing (the same; see probe_iso9660 in util-linux-2.29.2/libblkid/src/superblocks/iso9660.c).

Pushed as c6aee77e297ee9c96412825127a921dbd1d10e92 to master.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 27265@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 27265
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help