From unknown Sun Jun 22 22:40:40 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#26751 <26751@debbugs.gnu.org> To: bug#26751 <26751@debbugs.gnu.org> Subject: Status: [PATCH] gnu: build: file-systems: Add ISO-9660. Reply-To: bug#26751 <26751@debbugs.gnu.org> Date: Mon, 23 Jun 2025 05:40:40 +0000 retitle 26751 [PATCH] gnu: build: file-systems: Add ISO-9660. reassign 26751 guix-patches submitter 26751 Danny Milosavljevic severity 26751 normal tag 26751 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Tue May 02 16:05:04 2017 Received: (at submit) by debbugs.gnu.org; 2 May 2017 20:05:04 +0000 Received: from localhost ([127.0.0.1]:51562 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d5e2g-0001Mv-OR for submit@debbugs.gnu.org; Tue, 02 May 2017 16:05:03 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53198) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d5e2f-0001MO-Ad for submit@debbugs.gnu.org; Tue, 02 May 2017 16:05:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d5e2Z-000632-2V for submit@debbugs.gnu.org; Tue, 02 May 2017 16:04:56 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:33066) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d5e2Y-00062u-Vd for submit@debbugs.gnu.org; Tue, 02 May 2017 16:04:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5e2X-0008Dp-HL for guix-patches@gnu.org; Tue, 02 May 2017 16:04:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d5e2T-00060B-VN for guix-patches@gnu.org; Tue, 02 May 2017 16:04:53 -0400 Received: from dd1012.kasserver.com ([85.13.128.8]:56568) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d5e2T-0005yj-OU for guix-patches@gnu.org; Tue, 02 May 2017 16:04:49 -0400 Received: from dayas.3.home (178.113.134.174.wireless.dyn.drei.com [178.113.134.174]) by dd1012.kasserver.com (Postfix) with ESMTPSA id E2FD81CA00C1; Tue, 2 May 2017 22:04:42 +0200 (CEST) From: Danny Milosavljevic To: guix-patches@gnu.org Subject: [PATCH] gnu: build: file-systems: Add ISO-9660. Date: Tue, 2 May 2017 22:04:36 +0200 Message-Id: <20170502200436.29885-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.12.1 Tags: patch X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit Cc: Danny Milosavljevic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) * 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. --- gnu/build/file-systems.scm | 67 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 2 deletions(-) diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm index 0cb84b8aa..e2a6cd626 100644 --- a/gnu/build/file-systems.scm +++ b/gnu/build/file-systems.scm @@ -230,6 +230,65 @@ Trailing spaces are trimmed." ;;; +;;; ISO9660 file systems. +;;; + +;; . + +(define (iso9660-superblock? sblock) + "Return #t when SBLOCK is a iso9660 superblock." + (bytevector=? (sub-bytevector sblock 1 6) + ;; Note: "\x01" is the volume descriptor format version + (string->utf8 "CD001\x01"))) + +(define (read-iso9660-primary-volume-descriptor device offset) + "Find and read the first primary volume descriptor, starting at OFFSET. + Return #f if not found." + (let* ((sblock (read-superblock device offset 2048 iso9660-superblock?)) + (type-code (if sblock (array-ref sblock 0) 255))) + (match type-code + (255 #f) ; Volume Descriptor Set Terminator. + (1 sblock) ; Primary Volume Descriptor + (_ (read-iso9660-primary-volume-descriptor device (+ offset 2048)))))) + +(define (read-iso9660-superblock device) + "Return the raw contents of DEVICE's iso9660 superblock as a bytevector, or +#f if DEVICE does not contain a iso9660 file system." + ;; Start reading at sector 16. + (read-iso9660-primary-volume-descriptor device (* 2048 16))) + +(define (iso9660-superblock-uuid sblock) + "Return the Volume ID of a iso9660 superblock SBLOCK as a 4-byte bytevector." + ;; Note: The field is the volume creation time. + ;; FIXME Use only certain parts (See grub). + ;; FIXME treat "all 0" as invalid. + (sub-bytevector sblock 813 17)) + +(define (iso9660-uuid->string uuid) + ;; 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". + (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)) + ;; offset: In 15 min intervals, two's complement, from GMT. + (offset (bytevector-u8-ref uuid 16)) + (parts (list year month day hour minute second hundreths))) + (string-append (string-join (map digits->string parts))))) + +(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)) + + +;;; ;;; LUKS encrypted devices. ;;; @@ -340,7 +399,9 @@ partition field reader that returned a value." (_ #f))) (define %partition-label-readers - (list (partition-field-reader read-ext2-superblock + (list (partition-field-reader read-iso9660-superblock + iso9660-superblock-volume-name) + (partition-field-reader read-ext2-superblock ext2-superblock-volume-name) (partition-field-reader read-btrfs-superblock btrfs-superblock-volume-name) @@ -348,7 +409,9 @@ partition field reader that returned a value." fat32-superblock-volume-name))) (define %partition-uuid-readers - (list (partition-field-reader read-ext2-superblock + (list (partition-field-reader read-iso9660-superblock + iso9660-superblock-uuid) + (partition-field-reader read-ext2-superblock ext2-superblock-uuid) (partition-field-reader read-btrfs-superblock btrfs-superblock-uuid) From debbugs-submit-bounces@debbugs.gnu.org Tue May 02 16:32:21 2017 Received: (at 26751) by debbugs.gnu.org; 2 May 2017 20:32:21 +0000 Received: from localhost ([127.0.0.1]:51577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d5eT7-00020t-CJ for submit@debbugs.gnu.org; Tue, 02 May 2017 16:32:21 -0400 Received: from dd1012.kasserver.com ([85.13.128.8]:51178) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d5eT5-00020l-Mt for 26751@debbugs.gnu.org; Tue, 02 May 2017 16:32:20 -0400 Received: from dayas.3.home (178.113.134.174.wireless.dyn.drei.com [178.113.134.174]) by dd1012.kasserver.com (Postfix) with ESMTPSA id 6CA0C1CA00C1; Tue, 2 May 2017 22:32:16 +0200 (CEST) From: Danny Milosavljevic To: 26751@debbugs.gnu.org Subject: [PATCH v2] gnu: build: file-systems: Add ISO-9660. Date: Tue, 2 May 2017 22:32:09 +0200 Message-Id: <20170502203209.13124-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.12.1 In-Reply-To: <20170502200436.29885-1-dannym@scratchpost.org> References: <20170502200436.29885-1-dannym@scratchpost.org> Tags: patch X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 26751 Cc: Danny Milosavljevic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) * 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. --- gnu/build/file-systems.scm | 64 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm index 0cb84b8aa..3e702cc8d 100644 --- a/gnu/build/file-systems.scm +++ b/gnu/build/file-systems.scm @@ -230,6 +230,62 @@ Trailing spaces are trimmed." ;;; +;;; ISO9660 file systems. +;;; + +;; . + +(define (iso9660-superblock? sblock) + "Return #t when SBLOCK is a iso9660 superblock." + (bytevector=? (sub-bytevector sblock 1 6) + ;; Note: "\x01" is the volume descriptor format version + (string->utf8 "CD001\x01"))) + +(define (read-iso9660-primary-volume-descriptor device offset) + "Find and read the first primary volume descriptor, starting at OFFSET. + Return #f if not found." + (let* ((sblock (read-superblock device offset 2048 iso9660-superblock?)) + (type-code (if sblock (array-ref sblock 0) 255))) + (match type-code + (255 #f) ; Volume Descriptor Set Terminator. + (1 sblock) ; Primary Volume Descriptor + (_ (read-iso9660-primary-volume-descriptor device (+ offset 2048)))))) + +(define (read-iso9660-superblock device) + "Return the raw contents of DEVICE's iso9660 superblock as a bytevector, or +#f if DEVICE does not contain a iso9660 file system." + ;; Start reading at sector 16. + (read-iso9660-primary-volume-descriptor device (* 2048 16))) + +(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. + ;; 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))))) + +(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)) + + +;;; ;;; LUKS encrypted devices. ;;; @@ -340,7 +396,9 @@ partition field reader that returned a value." (_ #f))) (define %partition-label-readers - (list (partition-field-reader read-ext2-superblock + (list (partition-field-reader read-iso9660-superblock + iso9660-superblock-volume-name) + (partition-field-reader read-ext2-superblock ext2-superblock-volume-name) (partition-field-reader read-btrfs-superblock btrfs-superblock-volume-name) @@ -348,7 +406,9 @@ partition field reader that returned a value." fat32-superblock-volume-name))) (define %partition-uuid-readers - (list (partition-field-reader read-ext2-superblock + (list (partition-field-reader read-iso9660-superblock + iso9660-superblock-uuid) + (partition-field-reader read-ext2-superblock ext2-superblock-uuid) (partition-field-reader read-btrfs-superblock btrfs-superblock-uuid) From debbugs-submit-bounces@debbugs.gnu.org Tue May 02 17:32:26 2017 Received: (at 26751) by debbugs.gnu.org; 2 May 2017 21:32:26 +0000 Received: from localhost ([127.0.0.1]:51628 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d5fPG-0005Ai-Hq for submit@debbugs.gnu.org; Tue, 02 May 2017 17:32:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47995) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d5fPE-0005AT-C0 for 26751@debbugs.gnu.org; Tue, 02 May 2017 17:32:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d5fP6-0002Ta-2G for 26751@debbugs.gnu.org; Tue, 02 May 2017 17:32:19 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37203) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5fP5-0002TW-Ux; Tue, 02 May 2017 17:32:15 -0400 Received: from reverse-83.fdn.fr ([80.67.176.83]:53854 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1d5fP5-0000J4-BZ; Tue, 02 May 2017 17:32:15 -0400 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Danny Milosavljevic Subject: Re: bug#26751: [PATCH v2] gnu: build: file-systems: Add ISO-9660. References: <20170502200436.29885-1-dannym@scratchpost.org> <20170502203209.13124-1-dannym@scratchpost.org> Date: Tue, 02 May 2017 23:32:13 +0200 In-Reply-To: <20170502203209.13124-1-dannym@scratchpost.org> (Danny Milosavljevic's message of "Tue, 2 May 2017 22:32:09 +0200") Message-ID: <87zievymg2.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 26751 Cc: 26751@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Danny Milosavljevic 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 byte= vector." > + ;; 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/b= y-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) (lamb= da (c) #f)) #\space)) Please trim to 80 columns. :-) OK with these changes, thank you! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sun May 07 15:21:11 2017 Received: (at control) by debbugs.gnu.org; 7 May 2017 19:21:11 +0000 Received: from localhost ([127.0.0.1]:60752 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7Rjz-0000tK-1b for submit@debbugs.gnu.org; Sun, 07 May 2017 15:21:11 -0400 Received: from dd1012.kasserver.com ([85.13.128.8]:50480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7Rjx-0000tD-RY for control@debbugs.gnu.org; Sun, 07 May 2017 15:21:10 -0400 Received: from localhost (77.118.221.44.wireless.dyn.drei.com [77.118.221.44]) by dd1012.kasserver.com (Postfix) with ESMTPSA id 7AA061CA0438 for ; Sun, 7 May 2017 21:21:08 +0200 (CEST) Date: Sun, 7 May 2017 21:21:06 +0200 From: Danny Milosavljevic To: control@debbugs.gnu.org Message-ID: <20170507212106.7b1c20b4@scratchpost.org> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: close 26166 close 26541 close 26614 close 26751 close 26692 close 26731 close 26743 close 26744 [...] Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [85.13.128.8 listed in list.dnswl.org] 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: close 26166 close 26541 close 26614 close 26751 close 26692 close 26731 close 26743 close 26744 [...] Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [85.13.128.8 listed in list.dnswl.org] 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject close 26166 close 26541 close 26614 close 26751 close 26692 close 26731 close 26743 close 26744 From unknown Sun Jun 22 22:40:40 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 05 Jun 2017 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator