* bug#27265: [PATCH] file-systems: Use creation time if modification time is unset for ISO9660.
@ 2017-06-06 8:50 Danny Milosavljevic
2017-06-06 23:19 ` Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: Danny Milosavljevic @ 2017-06-06 8:50 UTC (permalink / raw)
To: 27265
* 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."
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#27265: [PATCH] file-systems: Use creation time if modification time is unset for ISO9660.
2017-06-06 8:50 bug#27265: [PATCH] file-systems: Use creation time if modification time is unset for ISO9660 Danny Milosavljevic
@ 2017-06-06 23:19 ` Ludovic Courtès
2017-06-07 6:35 ` Danny Milosavljevic
0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2017-06-06 23:19 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: 27265
Danny Milosavljevic <dannym@scratchpost.org> skribis:
> * 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’.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#27265: [PATCH] file-systems: Use creation time if modification time is unset for ISO9660.
2017-06-06 23:19 ` Ludovic Courtès
@ 2017-06-07 6:35 ` Danny Milosavljevic
0 siblings, 0 replies; 3+ messages in thread
From: Danny Milosavljevic @ 2017-06-07 6:35 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 27265-done
Hi Ludo,
On Wed, 07 Jun 2017 01:19:34 +0200
ludo@gnu.org (Ludovic Courtès) wrote:
> 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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-07 6:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-06 8:50 bug#27265: [PATCH] file-systems: Use creation time if modification time is unset for ISO9660 Danny Milosavljevic
2017-06-06 23:19 ` Ludovic Courtès
2017-06-07 6:35 ` Danny Milosavljevic
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).