GNU bug report logs - #62827
[PATCH] image: Add partition type-uuid support.

Previous Next

Package: guix-patches;

Reported by: Aleksandr Vityazev <avityazew <at> gmail.com>

Date: Fri, 14 Apr 2023 06:54:02 UTC

Severity: normal

Tags: patch

Done: Mathieu Othacehe <othacehe <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 62827 in the body.
You can then email your comments to 62827 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#62827; Package guix-patches. (Fri, 14 Apr 2023 06:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Aleksandr Vityazev <avityazew <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 14 Apr 2023 06:54:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Aleksandr Vityazev <avityazew <at> gmail.com>
To: guix-patches <at> gnu.org
Subject: [PATCH] image: Add partition type-uuid support.
Date: Fri, 14 Apr 2023 09:53:14 +0300
* gnu/image.scm (<partition>)[type-uuid]: New field,
(partition-type-uuid): new exported procedure.
* gnu/system/image.scm (partition->dos-type, partition->gpt-type):
Adapt accordingly.
* doc/guix.texi (partition Reference): Document it.
---
 doc/guix.texi        | 5 +++++
 gnu/image.scm        | 4 ++++
 gnu/system/image.scm | 9 +++++++--
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index adb1975935..7e42fcd0fc 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -43834,6 +43834,11 @@ The partition UUID as an @code{uuid} record (@pxref{File Systems}).  By
 default it is @code{#false}, which means that the partition creation
 tool will attribute a random UUID to the partition.
 
+@item @code{type-uuid} (default: @code{#false})
+The partition type UUID as an @code{uuid} record.  By default it is
+@code{#false}, which means the type UUID will be defined according to
+@code{flags} or @code{file-system}.
+
 @item @code{flags} (default: @code{'()})
 The partition flags as a list of symbols.  Possible values are
 @code{'boot} and @code{'esp}.  The @code{'boot} flags should be set if
diff --git a/gnu/image.scm b/gnu/image.scm
index 523653dd77..be8b725d37 100644
--- a/gnu/image.scm
+++ b/gnu/image.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2020, 2022 Mathieu Othacehe <othacehe <at> gnu.org>
+;;; Copyright © 2023 Aleksandr Vityazev <avityazew <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -33,6 +34,7 @@ (define-module (gnu image)
             partition-file-system-options
             partition-label
             partition-uuid
+            partition-type-uuid
             partition-flags
             partition-initializer
 
@@ -126,6 +128,8 @@ (define-record-type* <partition> partition make-partition
   (label                partition-label)  ;string
   (uuid                 partition-uuid
                         (default #false))  ;<uuid>
+  (type-uuid            partition-type-uuid ;<uuid>
+                        (default #false))
   (flags                partition-flags
                         (default '())  ;list of symbols
                         (sanitize validate-partition-flags))
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index afef79185f..cca3c54b1b 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2022 Pavel Shlyak <p.shlyak <at> pantherx.org>
 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
 ;;; Copyright © 2022 Alex Griffin <a <at> ajgrf.com>
+;;; Copyright © 2023 Aleksandr Vityazev <avityazew <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -364,8 +365,10 @@ (define (partition->dos-type partition)
       ;; Return the MBR partition type corresponding to the given PARTITION.
       ;; See: https://en.wikipedia.org/wiki/Partition_type.
       (let ((flags (partition-flags partition))
-            (file-system (partition-file-system partition)))
+            (file-system (partition-file-system partition))
+            (type-uuid (partition-type-uuid partition)))
         (cond
+         (type-uuid (uuid->string type-uuid))
          ((member 'esp flags) "0xEF")
          ((string-prefix? "ext" file-system) "0x83")
          ((or (string=? file-system "vfat")
@@ -383,8 +386,10 @@ (define (partition->gpt-type partition)
       ;; given PARTITION.  See:
       ;; https://github.com/pengutronix/genimage/blob/master/README.rst
       (let ((flags (partition-flags partition))
-            (file-system (partition-file-system partition)))
+            (file-system (partition-file-system partition))
+            (type-uuid (partition-type-uuid partition)))
         (cond
+         (type-uuid (uuid->string type-uuid))
          ((member 'esp flags) "U")
          ((string-prefix? "ext" file-system) "L")
          ((or (string=? file-system "vfat")

base-commit: c371555a4b46a5c9288f54753b0f158f9c4b8abc
prerequisite-patch-id: 170079138c52aa59aa21a917f8d6b178c80c85d8
prerequisite-patch-id: 947e2640dcf1b47e6b1160b7525cbe7f7300e50b
-- 
2.39.2


-- 

Aleksandr Vityazev




Information forwarded to guix-patches <at> gnu.org:
bug#62827; Package guix-patches. (Sat, 13 May 2023 08:07:01 GMT) Full text and rfc822 format available.

Message #8 received at 62827 <at> debbugs.gnu.org (full text, mbox):

From: Josselin Poiret <dev <at> jpoiret.xyz>
To: Aleksandr Vityazev <avityazew <at> gmail.com>, 62827 <at> debbugs.gnu.org
Subject: Re: [bug#62827] [PATCH] image: Add partition type-uuid support.
Date: Sat, 13 May 2023 10:06:01 +0200
[Message part 1 (text/plain, inline)]
Hi Aleksandr,

Aleksandr Vityazev <avityazew <at> gmail.com> writes:

> @@ -364,8 +365,10 @@ (define (partition->dos-type partition)
>        ;; Return the MBR partition type corresponding to the given PARTITION.
>        ;; See: https://en.wikipedia.org/wiki/Partition_type.
>        (let ((flags (partition-flags partition))
> -            (file-system (partition-file-system partition)))
> +            (file-system (partition-file-system partition))
> +            (type-uuid (partition-type-uuid partition)))
>          (cond
> +         (type-uuid (uuid->string type-uuid))
>           ((member 'esp flags) "0xEF")
>           ((string-prefix? "ext" file-system) "0x83")
>           ((or (string=? file-system "vfat")

MBR partitions use a single byte to represent the type, and we don't
have any corresponding uuid type for that, so this wouldn't work.
Adding a UUID type for MBR should be the way forward.

The GPT partition side seems good to me, but it would be nice if the
description in the manual included the expected formats of the UUIDs,
depending on the partition table type.  Examples would be welcome there
as well.

Best,
-- 
Josselin Poiret
[signature.asc (application/pgp-signature, inline)]

Reply sent to Mathieu Othacehe <othacehe <at> gnu.org>:
You have taken responsibility. (Sat, 14 Oct 2023 20:06:01 GMT) Full text and rfc822 format available.

Notification sent to Aleksandr Vityazev <avityazew <at> gmail.com>:
bug acknowledged by developer. (Sat, 14 Oct 2023 20:06:02 GMT) Full text and rfc822 format available.

Message #13 received at 62827-done <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Aleksandr Vityazev <avityazew <at> gmail.com>
Cc: 62827-done <at> debbugs.gnu.org
Subject: Re: [bug#62827] [PATCH] image: Add partition type-uuid support.
Date: Sat, 14 Oct 2023 22:04:53 +0200
Hello,

> -            (file-system (partition-file-system partition)))
> +            (file-system (partition-file-system partition))
> +            (type-uuid (partition-type-uuid partition)))
>          (cond
> +         (type-uuid (uuid->string type-uuid))
>           ((member 'esp flags) "0xEF")

This one was been opened for a while. There are no UUIDs on MBR so I
doubt this makes sense.

Closing,

Thanks,

Mathieu




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 12 Nov 2023 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 166 days ago.

Previous Next


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