GNU bug report logs - #27265
[PATCH] file-systems: Use creation time if modification time is unset for ISO9660.

Previous Next

Package: guix-patches;

Reported by: Danny Milosavljevic <dannym <at> scratchpost.org>

Date: Tue, 6 Jun 2017 08:51:02 UTC

Severity: normal

Tags: patch

Done: Danny Milosavljevic <dannym <at> scratchpost.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: 27265 <at> debbugs.gnu.org
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: bug#27265: [PATCH] file-systems: Use creation time if modification time is unset for ISO9660.
Date: Tue,  6 Jun 2017 10:50:37 +0200
* 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.
 
 (define (iso9660-uuid->string uuid)
   "Given an UUID bytevector, return its timestamp string."




This bug report was last modified 8 years and 71 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.