public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Brian C. Lane <bcl@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/parted] rawhide: - tests: t3000-resize-fs.sh mount fails (bcl)
Date: Thu, 19 Nov 2026 19:19:40 GMT	[thread overview]
Message-ID: <179511598005.1.9399646754634804566.rpms-parted-75c8ca41a246@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/parted
            Branch : rawhide
            Commit : 75c8ca41a246d34f96b1fe1ffb4babcef8ee9360
            Author : Brian C. Lane <bcl@redhat.com>
            Date   : 2026-11-19T11:14:36-08:00
            Stats  : +774/-1 in 5 file(s)
            URL    : https://src.fedoraproject.org/rpms/parted/c/75c8ca41a246d34f96b1fe1ffb4babcef8ee9360?branch=rawhide

            Log:
            - tests: t3000-resize-fs.sh mount fails (bcl)
- tests: Added tests for setting disk and partition uuid (aschnell)
- Add command uuid to set UUID of partition on GPT. (aschnell)
- Add command disk_uuid to set UUID of disk on GPT. (aschnell)

---
diff --git a/0001-Add-command-disk_uuid-to-set-UUID-of-disk-on-GPT.patch b/0001-Add-command-disk_uuid-to-set-UUID-of-disk-on-GPT.patch
new file mode 100644
index 0000000..171ce5b
--- /dev/null
+++ b/0001-Add-command-disk_uuid-to-set-UUID-of-disk-on-GPT.patch
@@ -0,0 +1,247 @@
+From f62bd31043d359e080db7919f05bcf2fe46b7284 Mon Sep 17 00:00:00 2001
+From: Arvin Schnell <aschnell@suse.de>
+Date: Tue, 17 Nov 2026 10:50:13 +0100
+Subject: [PATCH 1/4] Add command disk_uuid to set UUID of disk on GPT.
+
+This adds a new libparted function (ped_disk_set_uuid) and UI
+(disk_uuid) to set the disk UUID on GPT disklabels.
+
+Signed-off-by: Brian C. Lane <bcl@redhat.com>
+---
+ doc/C/parted.8           |  4 +++
+ doc/parted.texi          | 20 ++++++++++++++
+ include/parted/disk.in.h |  4 +++
+ libparted/disk.c         | 16 +++++++++++
+ libparted/labels/gpt.c   | 20 ++++++++++++++
+ parted/parted.c          | 60 ++++++++++++++++++++++++++++++++++++++++
+ 6 files changed, 124 insertions(+)
+
+diff --git a/doc/C/parted.8 b/doc/C/parted.8
+index 40e6212d..e3e73076 100644
+--- a/doc/C/parted.8
++++ b/doc/C/parted.8
+@@ -147,6 +147,10 @@ boot flag on the GPT's protective MBR partition.
+ .B disk_toggle \fIflag\fP
+ Toggle the state of the disk \fIflag\fP.
+ .TP
++.B disk_uuid \fIuuid\fP
++Set the UUID of the disk to \fIuuid\fP. This will only work if the disk
++label supports it (currently GPT).
++.TP
+ .B version
+ Display version information and a copyright message.
+ .RE
+diff --git a/doc/parted.texi b/doc/parted.texi
+index 10a576bc..644705ae 100644
+--- a/doc/parted.texi
++++ b/doc/parted.texi
+@@ -454,6 +454,7 @@ GNU Parted provides the following commands:
+ * align-check::
+ * disk_set::
+ * disk_toggle::
++* disk_uuid::
+ * help::
+ * mklabel::
+ * mkpart::
+@@ -540,6 +541,25 @@ Set the PMBR's boot flag.
+ Toggle the state of the disk flag.
+ @end deffn
+ 
++@node disk_uuid
++@subsection disk_uuid
++@cindex disk_uuid, command description
++@cindex command description, disk_uuid
++
++@deffn Command disk_uuid @var{uuid}
++
++Set the UUID of the disk to @var{uuid}. This will only work if the disk
++label supports it (currently GPT). The @var{uuid} is a 36-character string in
++standard UUID format.
++
++Example:
++
++@example
++(parted) @kbd{disk_uuid 12345678-abcd-1234-abcd-1234567890ab}
++@end example
++
++@end deffn
++
+ @node help
+ @subsection help
+ @cindex help, command description
+diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
+index e2ee7cab..3c69877b 100644
+--- a/include/parted/disk.in.h
++++ b/include/parted/disk.in.h
+@@ -231,7 +231,10 @@ struct _PedDiskOps {
+         int (*disk_is_flag_available) (
+                 const PedDisk *disk,
+                 PedDiskFlag flag);
++
++        int (*disk_set_uuid) (PedDisk* disk, const uint8_t* uuid);
+         uint8_t* (*disk_get_uuid) (const PedDisk* disk);
++
+         /** \todo add label guessing op here */
+ 
+         /* partition operations */
+@@ -337,6 +340,7 @@ extern int ped_disk_set_flag(PedDisk *disk, PedDiskFlag flag, int state);
+ extern int ped_disk_get_flag(const PedDisk *disk, PedDiskFlag flag);
+ extern int ped_disk_is_flag_available(const PedDisk *disk, PedDiskFlag flag);
+ 
++extern int ped_disk_set_uuid (PedDisk* disk, const uint8_t* uuid);
+ extern uint8_t* ped_disk_get_uuid (const PedDisk* disk);
+ 
+ extern const char *ped_disk_flag_get_name(PedDiskFlag flag);
+diff --git a/libparted/disk.c b/libparted/disk.c
+index f1da6c44..2939a3a4 100644
+--- a/libparted/disk.c
++++ b/libparted/disk.c
+@@ -906,6 +906,22 @@ _assert_disk_uuid_feature (const PedDiskType* disk_type)
+         return 1;
+ }
+ 
++/**
++ * Set the uuid of the disk \p disk. This will only work if the disk label
++ * supports it.
++ */
++int
++ped_disk_set_uuid (PedDisk *disk, const uint8_t* uuid)
++{
++        PED_ASSERT (disk != NULL);
++
++        if (!_assert_disk_uuid_feature (disk->type))
++                return 0;
++
++        PED_ASSERT (disk->type->ops->disk_set_uuid != NULL);
++        return disk->type->ops->disk_set_uuid (disk, uuid);
++}
++
+ /**
+  * Get the uuid of the disk \p disk. This will only work if the disk label
+  * supports it.
+diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
+index 5a48b9bb..ac40ec82 100644
+--- a/libparted/labels/gpt.c
++++ b/libparted/labels/gpt.c
+@@ -1578,6 +1578,25 @@ gpt_disk_is_flag_available(const PedDisk *disk, PedDiskFlag flag)
+     }
+ }
+ 
++
++static int
++gpt_disk_set_uuid (PedDisk *disk, const uint8_t *uuid)
++{
++  GPTDiskData *gpt_disk_data = disk->disk_specific;
++
++  efi_guid_t* disk_uuid = &gpt_disk_data->uuid;
++  memcpy(disk_uuid, uuid, sizeof (efi_guid_t));
++
++  /* disk_uuid is always LE, while uint8_t is always kind of BE */
++
++  disk_uuid->time_low = PED_SWAP32(disk_uuid->time_low);
++  disk_uuid->time_mid = PED_SWAP16(disk_uuid->time_mid);
++  disk_uuid->time_hi_and_version = PED_SWAP16(disk_uuid->time_hi_and_version);
++
++  return 1;
++}
++
++
+ static uint8_t*
+ gpt_disk_get_uuid (const PedDisk *disk)
+ {
+@@ -1911,6 +1930,7 @@ static PedDiskOps gpt_disk_ops =
+   disk_set_flag:		gpt_disk_set_flag,
+   disk_get_flag:		gpt_disk_get_flag,
+   disk_is_flag_available:	gpt_disk_is_flag_available,
++  disk_set_uuid:		gpt_disk_set_uuid,
+   disk_get_uuid:		gpt_disk_get_uuid,
+ 
+   PT_op_function_initializers (gpt)
+diff --git a/parted/parted.c b/parted/parted.c
+index f86619f7..1f639d59 100644
+--- a/parted/parted.c
++++ b/parted/parted.c
+@@ -161,6 +161,7 @@ static const char* number_msg = N_(
+ static const char* label_type_msg_start = N_("LABEL-TYPE is one of: ");
+ static const char* flag_msg_start =   N_("FLAG is one of: ");
+ static const char* disk_flag_msg_start =   N_("FLAG is one of: ");
++static const char* disk_uuid_msg =    N_("UUID is a UUID\n");
+ static const char* unit_msg_start =   N_("UNIT is one of: ");
+ static const char* min_or_opt_msg = N_("desired alignment: minimum or optimal");
+ static const char* part_type_msg =    N_("PART-TYPE is one of: primary, logical, "
+@@ -2066,6 +2067,57 @@ error:
+   return 0;
+ }
+ 
++
++static int
++do_disk_uuid(PedDevice** dev, PedDisk** diskp)
++{
++        if (!*diskp)
++                *diskp = ped_disk_new (*dev);
++        if (!*diskp)
++                goto error;
++
++        if (!ped_disk_type_check_feature((*diskp)->type, PED_DISK_TYPE_DISK_UUID)) {
++                ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
++                                     _("%s disk labels do not support disk uuid."),
++                                     (*diskp)->type->name);
++                goto error;
++        }
++
++        uint8_t* disk_uuid = ped_disk_get_uuid (*diskp);
++        if (!disk_uuid)
++                goto error;
++
++        static char buf[UUID_STR_LEN];
++        uuid_unparse_lower (disk_uuid, buf);
++        free (disk_uuid);
++
++        char* input = command_line_get_word (_("Disk uuid?"), buf, NULL, 0);
++        if (!input)
++                goto error;
++
++        uuid_t tmp;
++        if (uuid_parse (input, tmp) != 0 || uuid_is_null (tmp)) {
++                ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
++                                     _("Invalid uuid."));
++                goto error_free_input;
++        }
++
++        if (!ped_disk_set_uuid (*diskp, tmp))
++                goto error_free_input;
++
++        free (input);
++
++        if (!ped_disk_commit (*diskp))
++                goto error;
++        return 1;
++
++error_free_input:
++        free (input);
++error:
++        return 0;
++}
++
++
+ static int
+ do_disk_set (PedDevice** dev, PedDisk** diskp)
+ {
+@@ -2430,6 +2482,14 @@ _("disk_toggle [FLAG]                       toggle the state of FLAG on "
+ NULL),
+         str_list_create (disk_flag_msg, NULL), 1));
+ 
++command_register (commands, command_create (
++        str_list_create_unique ("disk_uuid", _("disk_uuid"), NULL),
++        do_disk_uuid,
++        str_list_create (
++_("disk_uuid UUID                           set UUID of disk"),
++NULL),
++        str_list_create (disk_uuid_msg, NULL), 1));
++
+ command_register (commands, command_create (
+ 		str_list_create_unique ("set", _("set"), NULL),
+ 		do_set,
+-- 
+2.56.1
+

diff --git a/0002-Add-command-uuid-to-set-UUID-of-partition-on-GPT.patch b/0002-Add-command-uuid-to-set-UUID-of-partition-on-GPT.patch
new file mode 100644
index 0000000..411935e
--- /dev/null
+++ b/0002-Add-command-uuid-to-set-UUID-of-partition-on-GPT.patch
@@ -0,0 +1,302 @@
+From 6d64356bf8f26118447f1e0a1c3723d66ab84bdc Mon Sep 17 00:00:00 2001
+From: Arvin Schnell <aschnell@suse.de>
+Date: Tue, 17 Nov 2026 10:50:14 +0100
+Subject: [PATCH 2/4] Add command uuid to set UUID of partition on GPT.
+
+This adds a new libparted function (ped_partition_set_uuid) and UI
+(uuid) to set the UUID of a GPT partition.
+
+NOTE: This changes interactive use since the uuid and units commands
+both start with 'u'. The full command, or unique prefix, needs to be
+used. During non-interactive use the 'u' shorthand is forced to mean
+units in order to maintain backwards compatibility.
+
+Signed-off-by: Brian C. Lane <bcl@redhat.com>
+---
+ doc/C/parted.8           |  4 +++
+ doc/parted.texi          | 20 +++++++++++++
+ include/parted/disk.in.h |  2 ++
+ libparted/disk.c         | 18 +++++++++++
+ libparted/labels/gpt.c   | 20 +++++++++++++
+ parted/command.c         |  2 +-
+ parted/command.h         |  2 +-
+ parted/parted.c          | 65 +++++++++++++++++++++++++++++++++++++++-
+ parted/ui.c              |  3 +-
+ 9 files changed, 132 insertions(+), 4 deletions(-)
+
+diff --git a/doc/C/parted.8 b/doc/C/parted.8
+index e3e73076..42f2d75e 100644
+--- a/doc/C/parted.8
++++ b/doc/C/parted.8
+@@ -138,6 +138,10 @@ On MS-DOS set the type aka. partition id of \fIpartition\fP to
+ \fIid\fP. The \fIid\fP is a value between "0x01" and "0xff". On GPT
+ the type-uuid of \fIpartition\fP to \fIuuid\fP.
+ .TP
++.B uuid \fIpartition\fP \fIuuid\fP
++Set the UUID of \fIpartition\fP to \fIuuid\fP. This will only work if
++the disk label supports it (currently GPT).
++.TP
+ .B disk_set \fIflag\fP \fIstate\fP
+ Change a \fIflag\fP on the disk to \fIstate\fP. A flag can be either "on" or
+ "off".  Some or all of these flags will be available, depending on what disk
+diff --git a/doc/parted.texi b/doc/parted.texi
+index 644705ae..77bef265 100644
+--- a/doc/parted.texi
++++ b/doc/parted.texi
+@@ -469,6 +469,7 @@ GNU Parted provides the following commands:
+ * toggle::
+ * type::
+ * unit::
++* uuid::
+ @end menu
+ 
+ Note that after version 2.4, the following commands were removed:
+@@ -1202,6 +1203,25 @@ Number  Start   End     Size    Type      File system  Flags
+ 
+ @end deffn
+ 
++@node uuid
++@subsection uuid
++@cindex uuid, command description
++@cindex command description, uuid
++
++@deffn Command uuid @var{number} @var{uuid}
++
++Set the UUID of partition @var{number} to @var{uuid}. This will only work
++if the disk label supports it (currently GPT). The @var{uuid} is a
++36-character string in standard UUID format.
++
++Example:
++
++@example
++(parted) @kbd{uuid 1 12345678-abcd-1234-abcd-1234567890ab}
++@end example
++
++@end deffn
++
+ @node Related information
+ @chapter Related information
+ @cindex further reading
+diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
+index 3c69877b..789ddfb3 100644
+--- a/include/parted/disk.in.h
++++ b/include/parted/disk.in.h
+@@ -267,6 +267,7 @@ struct _PedDiskOps {
+         int (*partition_set_type_uuid) (PedPartition* part, const uint8_t* uuid);
+         uint8_t* (*partition_get_type_uuid) (const PedPartition* part);
+ 
++        int (*partition_set_uuid) (PedPartition* part, const uint8_t* uuid);
+         uint8_t* (*partition_get_uuid) (const PedPartition* part);
+ 
+         int (*partition_align) (PedPartition* part,
+@@ -379,6 +380,7 @@ extern uint8_t ped_partition_get_type_id (const PedPartition* part);
+ extern int ped_partition_set_type_uuid (PedPartition* part, const uint8_t* uuid);
+ extern uint8_t* ped_partition_get_type_uuid (const PedPartition* part);
+ 
++extern int ped_partition_set_uuid (PedPartition* part, const uint8_t* uuid);
+ extern uint8_t* ped_partition_get_uuid (const PedPartition* part);
+ 
+ extern int ped_partition_is_busy (const PedPartition* part);
+diff --git a/libparted/disk.c b/libparted/disk.c
+index 2939a3a4..e0cf3d96 100644
+--- a/libparted/disk.c
++++ b/libparted/disk.c
+@@ -1679,6 +1679,24 @@ ped_partition_get_type_uuid (const PedPartition *part)
+         return part->disk->type->ops->partition_get_type_uuid (part);
+ }
+ 
++/**
++ * Set the part-uuid of the partition \p part. This will only work if the disk label
++ * supports it.
++ */
++int
++ped_partition_set_uuid (PedPartition *part, const uint8_t* uuid)
++{
++        PED_ASSERT (part != NULL);
++        PED_ASSERT (part->disk != NULL);
++        PED_ASSERT (ped_partition_is_active (part));
++
++        if (!_assert_partition_uuid_feature (part->disk->type))
++                return 0;
++
++        PED_ASSERT (part->disk->type->ops->partition_set_uuid != NULL);
++        return part->disk->type->ops->partition_set_uuid (part, uuid);
++}
++
+ /**
+  * Get the uuid of the partition \p part. This will only work if the disk label
+  * supports it.
+diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
+index ac40ec82..d63482f5 100644
+--- a/libparted/labels/gpt.c
++++ b/libparted/labels/gpt.c
+@@ -1809,6 +1809,25 @@ gpt_partition_get_type_uuid (const PedPartition *part)
+   return buf;
+ }
+ 
++
++static int
++gpt_partition_set_uuid (PedPartition *part, const uint8_t *uuid)
++{
++  GPTPartitionData *gpt_part_data = part->disk_specific;
++
++  efi_guid_t* part_uuid = &gpt_part_data->uuid;
++  memcpy(part_uuid, uuid, sizeof (efi_guid_t));
++
++  /* part_uuid is always LE, while uint8_t is always kind of BE */
++
++  part_uuid->time_low = PED_SWAP32(part_uuid->time_low);
++  part_uuid->time_mid = PED_SWAP16(part_uuid->time_mid);
++  part_uuid->time_hi_and_version = PED_SWAP16(part_uuid->time_hi_and_version);
++
++  return 1;
++}
++
++
+ static uint8_t*
+ gpt_partition_get_uuid (const PedPartition *part)
+ {
+@@ -1926,6 +1945,7 @@ static PedDiskOps gpt_disk_ops =
+   partition_get_type_id:	NULL,
+   partition_set_type_uuid:	gpt_partition_set_type_uuid,
+   partition_get_type_uuid:	gpt_partition_get_type_uuid,
++  partition_set_uuid:	        gpt_partition_set_uuid,
+   partition_get_uuid:		gpt_partition_get_uuid,
+   disk_set_flag:		gpt_disk_set_flag,
+   disk_get_flag:		gpt_disk_get_flag,
+diff --git a/parted/command.c b/parted/command.c
+index b5fb3994..e7b65246 100644
+--- a/parted/command.c
++++ b/parted/command.c
+@@ -72,7 +72,7 @@ command_register (Command** list, Command* cmd)
+ }
+ 
+ Command*
+-command_get (Command** list, char* name)
++command_get (Command** list, const char* name)
+ {
+ 	int		i;
+ 	int		partial_match = -1;
+diff --git a/parted/command.h b/parted/command.h
+index 966d96d6..3db5985d 100644
+--- a/parted/command.h
++++ b/parted/command.h
+@@ -39,7 +39,7 @@ extern Command* command_create (const StrList* names,
+ extern void command_destroy (Command* cmd);
+ void command_register (Command** list, Command* cmd);
+ 
+-extern Command* command_get (Command** list, char* name);
++extern Command* command_get (Command** list, const char* name);
+ extern StrList* command_get_names (Command** list);
+ extern void command_print_summary (Command* cmd);
+ extern void command_print_help (Command* cmd);
+diff --git a/parted/parted.c b/parted/parted.c
+index 1f639d59..80a45e38 100644
+--- a/parted/parted.c
++++ b/parted/parted.c
+@@ -178,6 +178,7 @@ static const char* device_msg =       N_("DEVICE is usually /dev/hda or /dev/sda
+ static const char* name_msg =         N_("NAME is any word you want\n");
+ static const char* type_msg =         N_("TYPE_ID is a value between 0x01 and 0xff, "
+                 "TYPE_UUID is a UUID\n");
++static const char* uuid_msg =         N_("UUID is a UUID\n");
+ 
+ static const char* copyright_msg = N_(
+ "Copyright (C) 1998 - 2006 Free Software Foundation, Inc.\n"
+@@ -1014,6 +1015,60 @@ error:
+         return 0;
+ }
+ 
++static int
++do_partition_uuid (PedDevice** dev, PedDisk** diskp)
++{
++        if (!*diskp)
++                *diskp = ped_disk_new (*dev);
++        if (!*diskp)
++                goto error;
++
++        if (!ped_disk_type_check_feature((*diskp)->type, PED_DISK_TYPE_PARTITION_UUID)) {
++                ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
++                                     _("%s disk labels do not support partition uuid."),
++                                     (*diskp)->type->name);
++                goto error;
++        }
++
++        PedPartition* part = NULL;
++        if (!command_line_get_partition (_("Partition number?"), *diskp, &part))
++                goto error;
++
++        uint8_t* part_uuid = ped_partition_get_uuid (part);
++        if (!part_uuid)
++                goto error;
++
++        static char buf[UUID_STR_LEN];
++        uuid_unparse_lower (part_uuid, buf);
++        free (part_uuid);
++
++        char* input = command_line_get_word (_("Partition uuid?"), buf, NULL, 0);
++        if (!input)
++                goto error;
++
++        uuid_t tmp;
++        if (uuid_parse (input, tmp) != 0 || uuid_is_null (tmp)) {
++                ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
++                                     _("Invalid uuid."));
++                goto error_free_input;
++        }
++
++        if (!ped_partition_set_uuid (part, tmp))
++                goto error_free_input;
++
++        free (input);
++
++        if (!ped_disk_commit (*diskp))
++                goto error;
++        return 1;
++
++error_free_input:
++        free (input);
++error:
++        return 0;
++}
++
++
+ static char*
+ partition_print_flags (PedPartition const *part)
+ {
+@@ -2512,10 +2567,18 @@ command_register (commands, command_create (
+         str_list_create_unique ("type", _("type"), NULL),
+         do_type,
+         str_list_create (
+-_("type NUMBER TYPE-ID or TYPE-UUID         type set TYPE-ID or TYPE-UUID of partition NUMBER"),
++_("type NUMBER TYPE-ID or TYPE-UUID         set TYPE-ID or TYPE-UUID of partition NUMBER"),
+ NULL),
+         str_list_create (_(number_msg), _(type_msg), NULL), 1));
+ 
++command_register (commands, command_create (
++        str_list_create_unique ("uuid", _("uuid"), NULL),
++        do_partition_uuid,
++        str_list_create (
++_("uuid NUMBER UUID                         set UUID of partition NUMBER"),
++NULL),
++        str_list_create (_(number_msg), _(uuid_msg), NULL), 1));
++
+ command_register (commands, command_create (
+         str_list_create_unique ("unit", _("unit"), NULL),
+         do_unit,
+diff --git a/parted/ui.c b/parted/ui.c
+index 3d491a24..5e7932c1 100644
+--- a/parted/ui.c
++++ b/parted/ui.c
+@@ -1679,7 +1679,8 @@ non_interactive_mode (PedDevice** dev, PedDisk **disk, Command* cmd_list[],
+                 if (!word)
+                         break;
+ 
+-                cmd = command_get (commands, word);
++                /* keep compatibility of abbreviation "u" for "unit" and not "uuid" */
++                cmd = command_get (commands, strcmp (word, "u") == 0 ? "unit" : word);
+                 free (word);
+                 if (!cmd) {
+                         help_msg ();
+-- 
+2.56.1
+

diff --git a/0003-tests-Added-tests-for-setting-disk-and-partition-uui.patch b/0003-tests-Added-tests-for-setting-disk-and-partition-uui.patch
new file mode 100644
index 0000000..0030253
--- /dev/null
+++ b/0003-tests-Added-tests-for-setting-disk-and-partition-uui.patch
@@ -0,0 +1,176 @@
+From 75e5c53c8577f62c1d26ed8e32b6d794b37b07a3 Mon Sep 17 00:00:00 2001
+From: Arvin Schnell <aschnell@suse.de>
+Date: Tue, 17 Nov 2026 10:50:15 +0100
+Subject: [PATCH 3/4] tests: Added tests for setting disk and partition uuid
+
+Signed-off-by: Brian C. Lane <bcl@redhat.com>
+---
+ tests/Makefile.am                    |  2 +
+ tests/t0920-uuid-gpt.sh              | 90 ++++++++++++++++++++++++++++
+ tests/t0921-uuid-gpt-reproducible.sh | 44 ++++++++++++++
+ 3 files changed, 136 insertions(+)
+ create mode 100755 tests/t0920-uuid-gpt.sh
+ create mode 100755 tests/t0921-uuid-gpt-reproducible.sh
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index e6bc912a..addcd295 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -44,6 +44,8 @@ TESTS = \
+   t0901-type-gpt-invalid.sh \
+   t0910-type-dos.sh \
+   t0911-type-dos-invalid.sh \
++  t0920-uuid-gpt.sh \
++  t0921-uuid-gpt-reproducible.sh \
+   t1100-busy-label.sh \
+   t1101-busy-partition.sh \
+   t1102-loop-label.sh \
+diff --git a/tests/t0920-uuid-gpt.sh b/tests/t0920-uuid-gpt.sh
+new file mode 100755
+index 00000000..a190b430
+--- /dev/null
++++ b/tests/t0920-uuid-gpt.sh
+@@ -0,0 +1,90 @@
++#!/bin/sh
++
++# Test disk_uuid and uuid commands with GPT label
++
++# Copyright (C) 2026 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++. "${srcdir=.}/init.sh"; path_prepend_ ../parted
++
++require_512_byte_sector_size_
++
++dev=loop-file
++
++# create image
++truncate --size 50MiB "$dev" || fail=1
++
++# create gpt label and one partition
++parted --script "$dev" mklabel gpt > out 2>&1 || fail=1
++parted --script "$dev" mkpart "test1" ext4 10% 20% > out 2>&1 || fail=1
++
++# set disk uuid and partition uuid
++parted --script "$dev" disk_uuid "351df77b-cfce-40fe-8fb2-3fb09ea36b4f" || fail=1
++parted --script "$dev" uuid 1 "f92e01b5-be06-4e95-8957-e97db3be2db1" || fail=1
++
++# print with json format (without replacing UUIDs since they are deterministic)
++parted --script --json "$dev" unit s print > out 2>&1 || fail=1
++
++cat <<EOF > exp || fail=1
++{
++   "disk": {
++      "path": "loop-file",
++      "size": "102400s",
++      "model": "",
++      "transport": "file",
++      "logical-sector-size": 512,
++      "physical-sector-size": 512,
++      "label": "gpt",
++      "uuid": "351df77b-cfce-40fe-8fb2-3fb09ea36b4f",
++      "max-partitions": 128,
++      "partitions": [
++         {
++            "number": 1,
++            "start": "10240s",
++            "end": "20479s",
++            "size": "10240s",
++            "type": "primary",
++            "type-uuid": "0fc63daf-8483-4772-8e79-3d69d8477de4",
++            "uuid": "f92e01b5-be06-4e95-8957-e97db3be2db1",
++            "name": "test1"
++         }
++      ]
++   }
++}
++EOF
++
++# remove full path of device from actual output
++mv out o2 && sed "s,\"/.*/$dev\",\"$dev\"," o2 > out || fail=1
++
++# check for expected output
++compare exp out || fail=1
++
++# test invalid UUIDs
++parted --script "$dev" disk_uuid "invalid-uuid" && fail=1
++parted --script "$dev" disk_uuid "00000000-0000-0000-0000-000000000000" && fail=1
++parted --script "$dev" uuid 1 "invalid-uuid" && fail=1
++parted --script "$dev" uuid 1 "00000000-0000-0000-0000-000000000000" && fail=1
++
++# test non-existent partition
++parted --script "$dev" uuid 2 "704cee3d-3d76-4450-8ed7-3b283325a526" && fail=1
++
++# test unsupported label (msdos)
++dev_msdos=loop-msdos
++truncate --size 20MiB "$dev_msdos" || fail=1
++parted --script "$dev_msdos" disk_uuid "67261cd9-da45-437e-a57c-c2250d0a1aa1" && fail=1
++parted --script "$dev_msdos" mklabel msdos mkpart primary ext4 1MiB 5MiB || fail=1
++parted --script "$dev_msdos" uuid 1 "14a812a3-0633-4069-bd19-79eb6f8fe8b1" && fail=1
++
++Exit $fail
+diff --git a/tests/t0921-uuid-gpt-reproducible.sh b/tests/t0921-uuid-gpt-reproducible.sh
+new file mode 100755
+index 00000000..f96c8682
+--- /dev/null
++++ b/tests/t0921-uuid-gpt-reproducible.sh
+@@ -0,0 +1,44 @@
++#!/bin/sh
++
++# Test reproducible GPT creation using disk_uuid and uuid commands
++
++# Copyright (C) 2026 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++. "${srcdir=.}/init.sh"; path_prepend_ ../parted
++
++require_512_byte_sector_size_
++
++sha256sum --version >/dev/null 2>&1 || skip_ "sha256sum is required for this test"
++
++dev=loop-file
++
++# create zeroed image
++truncate --size 50MiB "$dev" || fail=1
++
++# create gpt label, two partition, and set all UUIDs
++parted --script "$dev" mklabel gpt \
++       disk_uuid "d812fb48-9902-49a1-856a-eee66da8b826" || fail=1
++parted --script "$dev" mkpart "test1" ext4 2048s 10239s \
++       uuid 1 "7b492910-2456-4e62-80aa-0d877df63323" || fail=1
++parted --script "$dev" mkpart "test2" ext4 10240s 20479s \
++       uuid 2 "207d63b5-f9ec-4240-aa00-2fce00656723" || fail=1
++
++# verify exact sha256 checksum for reproducible builds
++sha256sum "$dev" > out || fail=1
++echo "837f295e07a0f0333b142ceb3f6a94d67c7312862615ebd272941c6ad3eb4cdd  $dev" > exp || fail=1
++compare exp out || fail=1
++
++Exit $fail
+-- 
+2.56.1
+

diff --git a/0004-tests-t3000-resize-fs.sh-mount-fails.patch b/0004-tests-t3000-resize-fs.sh-mount-fails.patch
new file mode 100644
index 0000000..8f66229
--- /dev/null
+++ b/0004-tests-t3000-resize-fs.sh-mount-fails.patch
@@ -0,0 +1,37 @@
+From 35909e6ae55fdfbde03c449a0ca170dda6bbbd3b Mon Sep 17 00:00:00 2001
+From: "Brian C. Lane" <bcl@redhat.com>
+Date: Mon, 16 Nov 2026 16:54:33 -0800
+Subject: [PATCH 4/4] tests: t3000-resize-fs.sh mount fails
+
+Running the test suite on Fedora 45 and the mount after making the fat32
+filesystem fails with:
+
+mount /dev/sdb1 /root/parted/tests/gt-t3000-resize-fs.sh.zUu3/mnt
+mount: /root/parted/tests/gt-t3000-resize-fs.sh.zUu3/mnt: wrong fs type, bad option, bad superblock on /dev/sdb1, missing codepage or helper program, or other error.
+       dmesg(1) may have more information after failed mount system call.
+
+Adding a call to wait_for_dev_to_appear_ fixes it so that it
+consistently passes. I could not see it remove the partition, either in
+udev event monitoring, or adding debugging to the test script, but it
+consistently fails without waiting.
+---
+ tests/t3000-resize-fs.sh | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh
+index 00518422..33703da3 100755
+--- a/tests/t3000-resize-fs.sh
++++ b/tests/t3000-resize-fs.sh
+@@ -86,6 +86,9 @@ for fs_type in $FSTYPES; do
+   # create the file system
+   $mkfs_cmd ${dev}1 || fail=1
+ 
++  # Make sure the partition is there
++  wait_for_dev_to_appear_ ${dev}1
++
+   # create 500 deep directory tree with longest name 4000 characters
+   # to catch core dump in libparted/fs/r/fat/count.c flag_traverse_dir()
+   # overflowing 512 byte file_name local buffer.
+-- 
+2.56.1
+

diff --git a/parted.spec b/parted.spec
index cf30cca..0cd4324 100644
--- a/parted.spec
+++ b/parted.spec
@@ -1,7 +1,7 @@
 Summary: The GNU disk partition manipulation program
 Name:    parted
 Version: 3.8
-Release: 2%{?dist}
+Release: 3%{?dist}.bcl.1
 License: GPL-3.0-or-later
 URL:     http://www.gnu.org/software/parted
 
@@ -10,6 +10,11 @@ Source1: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig
 Source2: pubkey.phillip.susi
 Source3: pubkey.brian.lane
 
+Patch0001: 0001-Add-command-disk_uuid-to-set-UUID-of-disk-on-GPT.patch
+Patch0002: 0002-Add-command-uuid-to-set-UUID-of-partition-on-GPT.patch
+Patch0003: 0003-tests-Added-tests-for-setting-disk-and-partition-uui.patch
+Patch0004: 0004-tests-t3000-resize-fs.sh-mount-fails.patch
+
 BuildRequires: gcc
 BuildRequires: e2fsprogs-devel
 BuildRequires: readline-devel
@@ -114,6 +119,12 @@ make check
 
 
 %changelog
+* Thu Nov 19 2026 Brian C. Lane <bcl@redhat.com> - 3.8-3.bcl.1
+- tests: t3000-resize-fs.sh mount fails (bcl)
+- tests: Added tests for setting disk and partition uuid (aschnell)
+- Add command uuid to set UUID of partition on GPT. (aschnell)
+- Add command disk_uuid to set UUID of disk on GPT. (aschnell)
+
 * Mon Oct 12 2026 Jakub Jelen <jjelen@redhat.com> - 3.8-2
 - Verify upstream source signatures with openpgpverify
 

                 reply	other threads:[~2026-11-19 19:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179511598005.1.9399646754634804566.rpms-parted-75c8ca41a246@fedoraproject.org \
    --to=bcl@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox