From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: GuixSD bootable ISO-9669 image Date: Thu, 08 Jun 2017 14:25:15 +0200 Message-ID: <877f0my8d0.fsf@gnu.org> References: <20170418141719.llp77itz7vyq5rij@abyayala> <87k26hwxt0.fsf@gmail.com> <8760i0m7vg.fsf@gnu.org> <87pog3u3ms.fsf@gmail.com> <87k26afl07.fsf_-_@gmail.com> <20170427190840.79bcaa76@scratchpost.org> <20170427220009.1d0d4607@scratchpost.org> <20170428101844.540ce399@scratchpost.org> <87efw7igen.fsf@gnu.org> <20170502220904.3f27ce9f@scratchpost.org> <871ss72cd2.fsf@gnu.org> <20170507213711.4eaec310@scratchpost.org> <87wp9rmo4d.fsf@gnu.org> <20170512013019.49c3d33d@scratchpost.org> <87o9uyqeda.fsf@gnu.org> <20170514232507.382d5472@scratchpost.org> <874lwlb3tj.fsf@gnu.org> <20170606113519.7c7bf656@scratchpost.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIwVA-0007mr-6u for guix-devel@gnu.org; Thu, 08 Jun 2017 08:25:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIwV6-0005SX-8I for guix-devel@gnu.org; Thu, 08 Jun 2017 08:25:24 -0400 In-Reply-To: <20170606113519.7c7bf656@scratchpost.org> (Danny Milosavljevic's message of "Tue, 6 Jun 2017 11:35:19 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Danny Milosavljevic Cc: guix-devel@gnu.org Howdy, Danny Milosavljevic skribis: > On Tue, 16 May 2017 10:31:36 +0200 > ludo@gnu.org (Ludovic Court=C3=A8s) wrote: >> Honestly, I was under the assumptions that DCE UUIDs was all that >> mattered: it works for ext2 and btrfs, right? I would think that people >> would rarely add FAT32 or ISO9660 UUIDs to the OS config.=20=20 > > With UEFI I thought that everyone has at least one FAT32 UUID in the OS c= onfig? I actually use the /dev device name but you=E2=80=99re right, we should be = using UUIDs in this case. > What's more, just by checking /dev/disk/by-uuid the user wouldn't know wh= at kind of filesystem it is. But he had to specify the file system type in= the config anyway - so it would be no worse than before. Okay then. > > What do you all think of the following? > > (define %iso9660-uuid-rx > ;; Y m d = H M S ss > (make-regexp "^([[:digit:]]{4})-([[:digit:]]{2})-([[:digit:]]{2})-([[:d= igit:]]{2})-([[:digit:]]{2})-([[:digit:]]{2})-([[:digit:]]{2})$")) > > (define (string->iso9660-uuid str) > "Parse STR as a ISO9660 UUID (which is really a timestamp - see /dev/di= sk/by-uuid). > Return its contents as a 16-byte bytevector. Return #f if STR is not a v= alid > ISO9660 UUID representation." > (and=3D> (regexp-exec %iso9660-uuid-rx str) > (lambda (match) > (letrec-syntax ((match-numeral > (syntax-rules () > ((_ index) > (match:substring match index))))) > (let ((year (match-numeral 1)) > (month (match-numeral 2)) > (day (match-numeral 3)) > (hour (match-numeral 4)) > (minute (match-numeral 5)) > (second (match-numeral 6)) > (hundredths (match-numeral 7))) > (string->utf8 (string-append year > month > day > hour > minute > second > hundredths))))))) LGTM! Or even: --8<---------------cut here---------------start------------->8--- (letrec-syntax ((match-numerals (syntax-rules () ((_ index (name rest ...) body) (let ((name (match:substring match index))) (match-numerals (+ 1 index) (rest ...) body))) ((_ index () body) body)))) (match-numerals 0 (year month day hour) (string-append year month day))) --8<---------------cut here---------------end--------------->8--- :-) > And also: > > (define string->btrfs-uuid string->uid) > (define string->ext2-uuid string->uid) > (define string->ext3-uuid string->uid) > ... Yes, sounds reasonable. Thanks! Ludo=E2=80=99.