Compare commits

..

1 commit

Author SHA1 Message Date
Brian C. Lane
5f5bcd1197 - Fix ped_partition_set_system handling of existing flags
Resolves: rhbz#2117048
2022-08-11 09:32:28 -07:00
32 changed files with 2655 additions and 806 deletions

View file

@ -1 +0,0 @@
1

5
.gitignore vendored
View file

@ -23,8 +23,3 @@ clog
/parted-3.4.64.tar.xz.sig
/parted-3.5.tar.xz
/parted-3.5.tar.xz.sig
/parted-3.5.28.tar.xz
/parted-3.5.28.tar.xz.sig
/parted-3.6.tar.xz
/parted-3.6.tar.xz.sig
/parted-3.6.tar.xz.sug

View file

@ -0,0 +1,50 @@
From cec533a00a2cd0b64a7a0f5debc26554f6025831 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 18 Apr 2022 15:10:06 -0400
Subject: [PATCH 1/5] maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
---
.prev-version | 2 +-
NEWS | 3 +++
cfg.mk | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/.prev-version b/.prev-version
index e917998..5a95802 100644
--- a/.prev-version
+++ b/.prev-version
@@ -1 +1 @@
-3.4.64.2
+3.5
diff --git a/NEWS b/NEWS
index 68a164a..2bd161f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
GNU parted NEWS -*- outline -*-
+* Noteworthy changes in release ?.? (????-??-??) [?]
+
+
* Noteworthy changes in release 3.5 (2022-04-18) [stable]
** New Features
diff --git a/cfg.mk b/cfg.mk
index d5fdd80..11fa51b 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -45,7 +45,7 @@ local-checks-to-skip = \
export VERBOSE = yes
# Hash of lines 42-208 for release 3.2
-old_NEWS_hash = 64a8f4d9ec1a5c256f3cc792450dc257
+old_NEWS_hash = 81f624d1d62a34f24e1286bd3cf5c736
include $(srcdir)/dist-check.mk
--
2.35.3

View file

@ -1,28 +0,0 @@
From fc16e90a9fd64e2db12a815417b538b193fe48db Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 10 Jul 2024 15:41:16 -0700
Subject: [PATCH 1/2] parted: Print the Fixing... message to stderr
Otherwise it messes up stdout of things like --json
Thanks to Mikael Q for reporting this.
---
parted/ui.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/parted/ui.c b/parted/ui.c
index 33a1808..d6d1da4 100644
--- a/parted/ui.c
+++ b/parted/ui.c
@@ -645,7 +645,7 @@ exception_handler (PedException* ex)
/* script-mode and fix? */
int fix_is_an_option = (ex->options & PED_EXCEPTION_FIX);
if (opt_script_mode && opt_fix_mode && fix_is_an_option) {
- printf ("Fixing, due to --fix\n");
+ fprintf (stderr, "Fixing, due to --fix\n");
return PED_EXCEPTION_FIX;
}
--
2.45.2

View file

@ -1,37 +0,0 @@
From e34c1477cfa446f1b44287b10425a9e69602b519 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 12 Jul 2024 16:24:58 -0700
Subject: [PATCH 2/2] doc: Document IEC unit behavior in the manpage
Previously this has only been documented in the info page.
---
doc/C/parted.8 | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/doc/C/parted.8 b/doc/C/parted.8
index 3069c33..171269c 100644
--- a/doc/C/parted.8
+++ b/doc/C/parted.8
@@ -151,6 +151,19 @@ Toggle the state of the disk \fIflag\fP.
.B version
Display version information and a copyright message.
.RE
+.SH UNITS
+\fBparted\fP will compute sensible ranges for the locations you specify when using
+units like "GB", "MB", etc. Use the sector unit "s" or IEC binary units like
+"GiB", "MiB", to specify exact locations.
+
+When you specify start or end values using IEC binary units like "MiB",
+"GiB", "TiB", etc., \fBparted\fP treats those values as exact, and equivalent to
+the same number specified in bytes (i.e., with the "B" suffix), in that it
+provides no helpful range of sloppiness. Contrast that with a partition
+start request of "4GB", which may actually resolve to some sector up to 500MB
+before or after that point. Thus, when creating a partition in an exact location
+you should use units of bytes ("B"), sectors ("s"), or IEC binary units like
+"MiB", "GiB", but not "MB", "GB", etc.
.SH REPORTING BUGS
Report bugs to <bug-parted@gnu.org>
.SH SEE ALSO
--
2.45.2

File diff suppressed because it is too large Load diff

View file

@ -1,55 +0,0 @@
From 8623f65e1fd064a679f75e3e075dff86f30282a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Old=C5=99ich=20Jedli=C4=8Dka?= <oldium.pro@gmail.com>
Date: Sat, 6 Apr 2024 19:21:11 +0200
Subject: [PATCH] libparted: Fail early when detecting nilfs2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When the disk is encrypted with TCG Opal HW encryption (supported by
cryptsetup 2.7.0+), the partition initially contains locked area, which
shows reading errors in kernel logs and may lead to configuring the disk
to work with lower reading speed. When the disk area is unlocked with
password, the reading succeeds. The beginning of the protected partition is
not locked and contains LUKS header, this is always readable.
To work around the errors when reading from the locked area, try first
detecting nilfs2 at the beginning (may be an unprotected LUKS header area)
and only check the second superblock that is at the end of the area (and
possibly locked) if the first one is valid (meaning the partition is not
LUKS-protected).
This is a change in behavior, but is consistent with the nilfs2 code, which
considers both superblocks mandatory, see [1].
[1] https://github.com/nilfs-dev/nilfs-utils/blob/master/lib/sb.c#L135-L158
Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
libparted/fs/nilfs2/nilfs2.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libparted/fs/nilfs2/nilfs2.c b/libparted/fs/nilfs2/nilfs2.c
index 6204542..40f8567 100644
--- a/libparted/fs/nilfs2/nilfs2.c
+++ b/libparted/fs/nilfs2/nilfs2.c
@@ -118,11 +118,12 @@ nilfs2_probe (PedGeometry* geom)
if (ped_geometry_read(geom, buf, 0, sectors))
sb = (struct nilfs2_super_block*)(buf + 1024);
+ if (!sb || !is_valid_nilfs_sb(sb))
+ return NULL;
+
if (ped_geometry_read(geom, buff2, sb2off, sectors2))
sb2 = (struct nilfs2_super_block*)buff2;
-
- if ((!sb || !is_valid_nilfs_sb(sb)) &&
- (!sb2 || !is_valid_nilfs_sb(sb2)))
+ if (!sb2 || !is_valid_nilfs_sb(sb2))
return NULL;
/* reserve 4k bytes for secondary superblock */
--
2.47.0

View file

@ -0,0 +1,228 @@
From 29ffc6a1f285f48ac0b9efa7299373e486c486e8 Mon Sep 17 00:00:00 2001
From: Arvin Schnell <aschnell@suse.com>
Date: Fri, 8 Oct 2021 10:06:24 +0000
Subject: [PATCH 3/5] libparted: add swap flag for DASD label
Support the swap flag and fix reading flags from disk. Also
cleanup code by dropping the 2 flags "raid" and "lvm" from
DasdPartitionData and instead use "system" directly.
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
include/parted/fdasd.in.h | 2 -
libparted/labels/dasd.c | 118 ++++++++++++++++----------------------
2 files changed, 50 insertions(+), 70 deletions(-)
diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h
index 9e5d7d1..e3ba183 100644
--- a/include/parted/fdasd.in.h
+++ b/include/parted/fdasd.in.h
@@ -28,10 +28,8 @@
#define PARTITION_LINUX_SWAP 0x82
#define PARTITION_LINUX 0x83
-#define PARTITION_LINUX_EXT 0x85
#define PARTITION_LINUX_LVM 0x8e
#define PARTITION_LINUX_RAID 0xfd
-#define PARTITION_LINUX_LVM_OLD 0xfe
#define PART_TYPE_NATIVE "NATIVE"
#define PART_TYPE_SWAP "SWAP "
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
index 0c00c4f..27baad0 100644
--- a/libparted/labels/dasd.c
+++ b/libparted/labels/dasd.c
@@ -53,10 +53,8 @@
#define PARTITION_LINUX_SWAP 0x82
#define PARTITION_LINUX 0x83
-#define PARTITION_LINUX_EXT 0x85
#define PARTITION_LINUX_LVM 0x8e
#define PARTITION_LINUX_RAID 0xfd
-#define PARTITION_LINUX_LVM_OLD 0xfe
extern void ped_disk_dasd_init ();
extern void ped_disk_dasd_done ();
@@ -66,8 +64,6 @@ extern void ped_disk_dasd_done ();
typedef struct {
int type;
int system;
- int raid;
- int lvm;
} DasdPartitionData;
typedef struct {
@@ -134,6 +130,31 @@ static PedDiskType dasd_disk_type = {
features: 0
};
+struct flag_id_mapping_t
+{
+ enum _PedPartitionFlag flag;
+ int type_id;
+};
+
+static const struct flag_id_mapping_t flag_id_mapping[] =
+{
+ { PED_PARTITION_LVM, PARTITION_LINUX_LVM },
+ { PED_PARTITION_RAID, PARTITION_LINUX_RAID },
+ { PED_PARTITION_SWAP, PARTITION_LINUX_SWAP },
+};
+
+static const struct flag_id_mapping_t* _GL_ATTRIBUTE_CONST
+dasd_find_flag_id_mapping (PedPartitionFlag flag)
+{
+ int n = sizeof(flag_id_mapping) / sizeof(flag_id_mapping[0]);
+
+ for (int i = 0; i < n; ++i)
+ if (flag_id_mapping[i].flag == flag)
+ return &flag_id_mapping[i];
+
+ return NULL;
+}
+
static PedDisk*
dasd_alloc (const PedDevice* dev)
{
@@ -310,8 +331,6 @@ dasd_read (PedDisk* disk)
part->num = 1;
part->fs_type = ped_file_system_probe (&part->geom);
dasd_data = part->disk_specific;
- dasd_data->raid = 0;
- dasd_data->lvm = 0;
dasd_data->type = 0;
if (!ped_disk_add_partition (disk, part, NULL))
@@ -394,8 +413,6 @@ dasd_read (PedDisk* disk)
part->num = 1;
part->fs_type = ped_file_system_probe (&part->geom);
dasd_data = part->disk_specific;
- dasd_data->raid = 0;
- dasd_data->lvm = 0;
dasd_data->type = 0;
if (!ped_disk_add_partition (disk, part, NULL))
@@ -452,25 +469,12 @@ dasd_read (PedDisk* disk)
dasd_data = part->disk_specific;
- if ((strncmp(PART_TYPE_RAID, str, 6) == 0) &&
- (ped_file_system_probe(&part->geom) == NULL))
- ped_partition_set_flag(part, PED_PARTITION_RAID, 1);
- else
- ped_partition_set_flag(part, PED_PARTITION_RAID, 0);
-
- if ((strncmp(PART_TYPE_LVM, str, 6) == 0) &&
- (ped_file_system_probe(&part->geom) == NULL))
- ped_partition_set_flag(part, PED_PARTITION_LVM, 1);
- else
- ped_partition_set_flag(part, PED_PARTITION_LVM, 0);
-
- if (strncmp(PART_TYPE_SWAP, str, 6) == 0) {
- fs = ped_file_system_probe(&part->geom);
- if (fs && is_linux_swap(fs->name)) {
- dasd_data->system = PARTITION_LINUX_SWAP;
- PDEBUG;
- }
- }
+ if (strncmp(PART_TYPE_RAID, str, 6) == 0)
+ dasd_data->system = PARTITION_LINUX_RAID;
+ else if (strncmp(PART_TYPE_LVM, str, 6) == 0)
+ dasd_data->system = PARTITION_LINUX_LVM;
+ else if (strncmp(PART_TYPE_SWAP, str, 6) == 0)
+ dasd_data->system = PARTITION_LINUX_SWAP;
vtoc_ebcdic_enc(p->f1->DS1DSNAM, p->f1->DS1DSNAM, 44);
@@ -747,20 +751,17 @@ dasd_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
PED_ASSERT(part->disk_specific != NULL);
dasd_data = part->disk_specific;
- switch (flag) {
- case PED_PARTITION_RAID:
- if (state)
- dasd_data->lvm = 0;
- dasd_data->raid = state;
- return ped_partition_set_system(part, part->fs_type);
- case PED_PARTITION_LVM:
- if (state)
- dasd_data->raid = 0;
- dasd_data->lvm = state;
- return ped_partition_set_system(part, part->fs_type);
- default:
- return 0;
+ const struct flag_id_mapping_t* p = dasd_find_flag_id_mapping (flag);
+ if (p)
+ {
+ if (state)
+ dasd_data->system = p->type_id;
+ else if (dasd_data->system == p->type_id)
+ return dasd_partition_set_system (part, part->fs_type);
+ return 1;
}
+
+ return 0;
}
static int
@@ -772,14 +773,11 @@ dasd_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
PED_ASSERT (part->disk_specific != NULL);
dasd_data = part->disk_specific;
- switch (flag) {
- case PED_PARTITION_RAID:
- return dasd_data->raid;
- case PED_PARTITION_LVM:
- return dasd_data->lvm;
- default:
- return 0;
- }
+ const struct flag_id_mapping_t* p = dasd_find_flag_id_mapping (flag);
+ if (p)
+ return dasd_data->system == p->type_id;
+
+ return 0;
}
/*
@@ -800,14 +798,10 @@ dasd_partition_is_flag_available (const PedPartition* part,
if (disk_specific->format_type == 1)
return 0;
- switch (flag) {
- case PED_PARTITION_RAID:
- return 1;
- case PED_PARTITION_LVM:
- return 1;
- default:
- return 0;
- }
+ if (dasd_find_flag_id_mapping (flag))
+ return 1;
+
+ return 0;
}
@@ -938,18 +932,6 @@ dasd_partition_set_system (PedPartition* part,
part->fs_type = fs_type;
- if (dasd_data->lvm) {
- dasd_data->system = PARTITION_LINUX_LVM;
- PDEBUG;
- return 1;
- }
-
- if (dasd_data->raid) {
- dasd_data->system = PARTITION_LINUX_RAID;
- PDEBUG;
- return 1;
- }
-
if (!fs_type) {
dasd_data->system = PARTITION_LINUX;
PDEBUG;
--
2.35.3

View file

@ -1,41 +0,0 @@
From 16343bda6ce0d41edf43f8dac368db3bbb63d271 Mon Sep 17 00:00:00 2001
From: Rudi Heitbaum <rudi@heitbaum.com>
Date: Wed, 20 Nov 2024 12:22:22 +0000
Subject: [PATCH] bug#74444: [PATCH] parted: fix do_version declaration
With gcc 15-20241117 compile fails with the below error, update the
do_version declaration to match the header in command.h
../../parted/parted.c: In function '_init_commands':
../../parted/parted.c:2469:9: error: passing argument 2 of 'command_create' from incompatible pointer type [-Wincompatible-pointer-types]
2469 | do_version,
| ^~~~~~~~~~
| |
| int (*)(void)
In file included from ../../parted/parted.c:28:
../../parted/command.h:35:39: note: expected 'int (*)(PedDevice **, PedDisk **)' {aka 'int (*)(struct _PedDevice **, struct _PedDisk **)'} but argument is of type 'int (*)(void)'
35 | int (*method) (PedDevice** dev, PedDisk** diskp),
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
parted/parted.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/parted/parted.c b/parted/parted.c
index 3abb52f..fc2aeba 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -2172,7 +2172,7 @@ do_unit (PedDevice** dev, PedDisk** diskp)
}
static int
-do_version ()
+do_version (PedDevice** dev, PedDisk** diskp)
{
printf ("\n%s\n%s",
prog_name,
--
2.47.0

View file

@ -0,0 +1,30 @@
From 9b0a83a747b28bd1b778bdd32616e6f7ea88c84d Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 13 May 2022 10:02:06 -0700
Subject: [PATCH 4/5] parted: Reset the filesystem type when changing the
id/uuid
Without this the print command keeps showing the type selected with
mkpart, which doesn't match the id/uuid set by the user. So rescan the
partition for a filesystem.
---
parted/parted.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/parted/parted.c b/parted/parted.c
index b8a4acf..96da30d 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -991,6 +991,9 @@ do_type (PedDevice** dev, PedDisk** diskp)
free (input);
+ // Reset the fs_type based on the filesystem, if it exists
+ part->fs_type = ped_file_system_probe (&part->geom);
+
if (!ped_disk_commit (*diskp))
goto error;
return 1;
--
2.35.3

View file

@ -1,31 +0,0 @@
From 95b877cfa36c1571487c2a67a3902f1f5c4dc747 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 7 Jan 2025 16:50:21 -0800
Subject: [PATCH 5/8] libparted: Fix sun disklabel unhandled exception
The CHS warning should only continue if ignored, not if unhandled.
Script mode, or exception handlers can return PED_EXCEPTION_UNHANDLED
which should act the same as a cancel. Previously it would only exit if
cancel was selected, allowing it to continue to use the bad CHS and
crash later.
---
libparted/labels/sun.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libparted/labels/sun.c b/libparted/labels/sun.c
index 5ed2886..853576b 100644
--- a/libparted/labels/sun.c
+++ b/libparted/labels/sun.c
@@ -284,7 +284,7 @@ _check_geometry_sanity (PedDisk* disk, SunRawLabel* label)
PED_BE16_TO_CPU(label->pcylcount),
PED_BE16_TO_CPU(label->ntrks),
PED_BE16_TO_CPU(label->nsect))
- == PED_EXCEPTION_CANCEL)
+ != PED_EXCEPTION_IGNORE)
return 0;
#endif
dev->bios_geom.sectors = PED_BE16_TO_CPU(label->nsect);
--
2.47.1

View file

@ -0,0 +1,23 @@
From ac2a35c2214ef42352d0ddb4f7f4cb77d116e92e Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 13 May 2022 10:15:41 -0700
Subject: [PATCH 5/5] tests: t3200-type-change now passes
---
tests/Makefile.am | 3 ---
1 file changed, 3 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2da653b..1d109d7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,3 @@
-XFAIL_TESTS = \
- t3200-type-change.sh
-
TEST_EXTENSIONS = .sh
SH_LOG_COMPILER = $(SHELL)
--
2.35.3

View file

@ -0,0 +1,59 @@
From aa690ee275db86d1edb2468bcf31c3d7cf81228e Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 4 Aug 2022 11:39:09 -0700
Subject: [PATCH] disk.in.h: Remove use of enums with #define
The preprocessor doesn't evaluate the enum, so it ends up being 0, which
causes problems for library users like pyparted which try to use the _LAST
value to conditionally include support for newer flags.
Instead just define the int that is the first and last entry in each enum.
Thanks to adamw and dcantrell for help arriving at a solution.
---
include/parted/disk.in.h | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
index 672c4ee..715637d 100644
--- a/include/parted/disk.in.h
+++ b/include/parted/disk.in.h
@@ -47,8 +47,9 @@ enum _PedDiskFlag {
/* This flag controls whether the boot flag of a GPT PMBR is set */
PED_DISK_GPT_PMBR_BOOT=2,
};
-#define PED_DISK_FIRST_FLAG PED_DISK_CYLINDER_ALIGNMENT
-#define PED_DISK_LAST_FLAG PED_DISK_GPT_PMBR_BOOT
+// NOTE: DO NOT define using enums
+#define PED_DISK_FIRST_FLAG 1 // PED_DISK_CYLINDER_ALIGNMENT
+#define PED_DISK_LAST_FLAG 2 // PED_DISK_GPT_PMBR_BOOT
/**
* Partition types
@@ -88,8 +89,9 @@ enum _PedPartitionFlag {
PED_PARTITION_BLS_BOOT=20,
PED_PARTITION_LINUX_HOME=21,
};
-#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT
-#define PED_PARTITION_LAST_FLAG PED_PARTITION_LINUX_HOME
+// NOTE: DO NOT define using enums
+#define PED_PARTITION_FIRST_FLAG 1 // PED_PARTITION_BOOT
+#define PED_PARTITION_LAST_FLAG 21 // PED_PARTITION_LINUX_HOME
enum _PedDiskTypeFeature {
PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */
@@ -97,8 +99,9 @@ enum _PedDiskTypeFeature {
PED_DISK_TYPE_PARTITION_TYPE_ID=4, /**< supports partition type-ids */
PED_DISK_TYPE_PARTITION_TYPE_UUID=8, /**< supports partition type-uuids */
};
-#define PED_DISK_TYPE_FIRST_FEATURE PED_DISK_TYPE_EXTENDED
-#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_PARTITION_TYPE_UUID
+// NOTE: DO NOT define using enums
+#define PED_DISK_TYPE_FIRST_FEATURE 1 // PED_DISK_TYPE_EXTENDED
+#define PED_DISK_TYPE_LAST_FEATURE 8 // PED_DISK_TYPE_PARTITION_TYPE_UUID
struct _PedDisk;
struct _PedPartition;
--
2.37.1

View file

@ -1,116 +0,0 @@
From bdb92f73112177c091a764836a9ceaa59f7e9b15 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 8 Jan 2025 11:59:40 -0800
Subject: [PATCH 6/8] tests: Add test for SUN disklabel handling
When fixed the output from script mode should be an unknown disklabel,
not sun.
---
tests/Makefile.am | 3 ++-
tests/sun-badlabel | 42 +++++++++++++++++++++++++++++++++++++
tests/t4002-sun-badlabel.sh | 23 ++++++++++++++++++++
3 files changed, 67 insertions(+), 1 deletion(-)
create mode 100755 tests/sun-badlabel
create mode 100644 tests/t4002-sun-badlabel.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fa27b44..00f4a9d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -67,6 +67,7 @@ TESTS = \
t3400-whole-disk-FAT-partition.sh \
t4000-sun-raid-type.sh \
t4001-sun-vtoc.sh \
+ t4002-sun-badlabel.sh \
t4100-msdos-partition-limits.sh \
t4100-dvh-partition-limits.sh \
t4100-msdos-starting-sector.sh \
@@ -103,7 +104,7 @@ TESTS = \
EXTRA_DIST = \
$(TESTS) t-local.sh t-lvm.sh \
init.cfg init.sh t-lib-helpers.sh gpt-header-munge \
- gpt-header-move msdos-overlap gpt-attrs
+ gpt-header-move msdos-overlap gpt-attrs sun-badlabel
check_PROGRAMS = print-align print-flags print-max dup-clobber duplicate \
fs-resize
diff --git a/tests/sun-badlabel b/tests/sun-badlabel
new file mode 100755
index 0000000..6a28e86
--- /dev/null
+++ b/tests/sun-badlabel
@@ -0,0 +1,42 @@
+#!/usr/bin/python3
+# Mangle the CHS values stored in a SUN disklabel
+# This sets CHS to 1 track, 2 sectors and updates the checksum
+# This triggers a bug in the SUN disklabel code when the CHS
+# error is UNHANDLED (in script mode or with a custom exception
+# handler) and it continues using a bad label which will coredump
+# when .duplicate() is called on it.
+
+import array
+from struct import unpack_from, pack_into
+import sys
+
+file = open(sys.argv[1],'rb+')
+header = file.read(512)
+
+# Make sure it looks like a SUN disklabel first
+magic = unpack_from(">H", header, 0x1FC)[0]
+if magic != 0xDABE:
+ raise RuntimeError("Not a SUN disklabel. magic = 0x%04X" % magic)
+csum = unpack_from(">H", header, 0x1FE)[0]
+ntrks = unpack_from(">H", header, 0x1B4)[0]
+nsect = unpack_from(">H", header, 0x1B6)[0]
+
+header = array.array('B', header)
+# cylinders at 0x1B0
+# modify ntrks at offset 0x1B4
+pack_into('>H', header, 0x1B4, 1)
+# modify nsect at offset 0x1B6
+pack_into('>H', header, 0x1B6, 2)
+
+## Undo old values
+csum ^= ntrks
+csum ^= nsect
+
+## Add new
+csum ^= 1
+csum ^= 2
+pack_into('>H', header, 0x1FE, csum)
+
+file.seek(0)
+file.write(header)
+file.close()
diff --git a/tests/t4002-sun-badlabel.sh b/tests/t4002-sun-badlabel.sh
new file mode 100644
index 0000000..177c0e4
--- /dev/null
+++ b/tests/t4002-sun-badlabel.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Test exception handling on a bad SUN disklabel
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted $srcdir
+ss=$sector_size_
+
+n_sectors=2000 # number of sectors
+dev=sun-disk-file
+# create an empty file as a test disk
+dd if=/dev/zero of=$dev bs=$ss count=$n_sectors 2> /dev/null || fail=1
+
+# label the test disk as a sun disk
+parted -s $dev mklabel sun > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+# Mangle the disklabel to have incorrect CHS values, but a valid checksum
+sun-badlabel $dev || fail=1
+
+# Check the output (this should return 1, but depend on checking the output for the test)
+parted -m -s $dev p > out 2>&1
+grep unknown out || { cat out; fail=1; }
+
+Exit $fail
--
2.47.1

View file

@ -1,29 +0,0 @@
From 1480769f2a7071c5a251b6c69658808199e8b05b Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 8 Jan 2025 13:35:04 -0800
Subject: [PATCH 7/8] libparted: Fix dvh disklabel unhandled exception
When an exception is using PED_EXCEPTION_IGNORE_CANCEL it should check
for !PED_EXCEPTION_IGNORE so that an unhandled exception is treated the
same as cancel. Otherwise it could lead to using the disklabel with
incorrect values.
---
libparted/labels/dvh.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libparted/labels/dvh.c b/libparted/labels/dvh.c
index 0f9124d..7d7dae3 100644
--- a/libparted/labels/dvh.c
+++ b/libparted/labels/dvh.c
@@ -308,7 +308,7 @@ dvh_read (PedDisk* disk)
PED_EXCEPTION_IGNORE_CANCEL,
_("Checksum is wrong, indicating the partition "
"table is corrupt."))
- == PED_EXCEPTION_CANCEL)
+ != PED_EXCEPTION_IGNORE)
return 0;
}
--
2.47.1

View file

@ -0,0 +1,101 @@
From 717d39a0a16b6fddfac65cf355a895d04995cdff Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 8 Aug 2022 12:04:32 -0700
Subject: [PATCH 07/10] libparted: Fix handling of gpt partition types
This restores the previous behavior by testing the GUID against the list
of known types and skipping the filesystem GUID reset. Now the sequence
of:
ped_partition_new(...)
ped_partition_set_flag(part, PED_PARTITION_BIOS_GRUB, 1);
ped_partition_set_system(part, ped_file_system_type_get("ext4"));
Will keep the GUID set to PED_PARTITION_BIOS_GRUB, which is how it used
to behave.
---
libparted/labels/gpt.c | 45 ++++++++++++++++++++++++++++++++++++++++--
1 file changed, 43 insertions(+), 2 deletions(-)
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 0e9e060..8e6a37d 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -196,6 +196,24 @@ static const struct flag_uuid_mapping_t flag_uuid_mapping[] =
{ PED_PARTITION_SWAP, PARTITION_SWAP_GUID },
};
+static const efi_guid_t skip_set_system_guids[] =
+{
+ PARTITION_LVM_GUID,
+ PARTITION_SWAP_GUID,
+ PARTITION_RAID_GUID,
+ PARTITION_PREP_GUID,
+ PARTITION_SYSTEM_GUID,
+ PARTITION_BIOS_GRUB_GUID,
+ PARTITION_HPSERVICE_GUID,
+ PARTITION_MSFT_RESERVED_GUID,
+ PARTITION_BASIC_DATA_GUID,
+ PARTITION_MSFT_RECOVERY,
+ PARTITION_APPLE_TV_RECOVERY_GUID,
+ PARTITION_IRST_GUID,
+ PARTITION_CHROMEOS_KERNEL_GUID,
+ PARTITION_BLS_BOOT_GUID,
+};
+
static const struct flag_uuid_mapping_t* _GL_ATTRIBUTE_CONST
gpt_find_flag_uuid_mapping (PedPartitionFlag flag)
{
@@ -1421,6 +1439,21 @@ gpt_partition_destroy (PedPartition *part)
_ped_partition_free (part);
}
+/* is_skip_guid checks the guid against the list of guids that should not be
+ * overridden by set_system. It returns a 1 if it is in the list.
+*/
+static bool
+is_skip_guid(efi_guid_t guid) {
+ int n = sizeof(skip_set_system_guids) / sizeof(skip_set_system_guids[0]);
+ for (int i = 0; i < n; ++i) {
+ if (guid_cmp(guid, skip_set_system_guids[i]) == 0) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
static int
gpt_partition_set_system (PedPartition *part,
const PedFileSystemType *fs_type)
@@ -1431,6 +1464,11 @@ gpt_partition_set_system (PedPartition *part,
part->fs_type = fs_type;
+ // Is this a GUID that should skip fs_type checking?
+ if (is_skip_guid(gpt_part_data->type)) {
+ return 1;
+ }
+
if (fs_type)
{
if (strncmp (fs_type->name, "fat", 3) == 0
@@ -1563,10 +1601,13 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
const struct flag_uuid_mapping_t* p = gpt_find_flag_uuid_mapping (flag);
if (p)
{
- if (state)
+ if (state) {
gpt_part_data->type = p->type_uuid;
- else if (guid_cmp (gpt_part_data->type, p->type_uuid) == 0)
+ } else if (guid_cmp (gpt_part_data->type, p->type_uuid) == 0) {
+ // Clear the GUID so that fs_type will be used to return it to the default
+ gpt_part_data->type = PARTITION_LINUX_DATA_GUID;
return gpt_partition_set_system (part, part->fs_type);
+ }
return 1;
}
--
2.37.1

View file

@ -0,0 +1,160 @@
From 14cf5be3d322d7e3e81c21a3542ae046a5fe1fda Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 8 Aug 2022 13:49:09 -0700
Subject: [PATCH 08/10] tests: Add a libparted test for
ped_partition_set_system on gpt
Test the libparted API to make sure the flag is not cleared by calling
ped_partition_set_system.
---
libparted/tests/Makefile.am | 6 ++-
libparted/tests/flags.c | 81 ++++++++++++++++++++++++++++++++++
libparted/tests/t1001-flags.sh | 23 ++++++++++
3 files changed, 108 insertions(+), 2 deletions(-)
create mode 100644 libparted/tests/flags.c
create mode 100755 libparted/tests/t1001-flags.sh
diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am
index fd5cba5..260b692 100644
--- a/libparted/tests/Makefile.am
+++ b/libparted/tests/Makefile.am
@@ -3,9 +3,10 @@
#
# This file may be modified and/or distributed without restriction.
-TESTS = t1000-label.sh t2000-disk.sh t2100-zerolen.sh t3000-symlink.sh t4000-volser.sh
+TESTS = t1000-label.sh t1001-flags.sh t2000-disk.sh t2100-zerolen.sh \
+ t3000-symlink.sh t4000-volser.sh
EXTRA_DIST = $(TESTS)
-check_PROGRAMS = label disk zerolen symlink volser
+check_PROGRAMS = label disk zerolen symlink volser flags
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
LDADD = \
@@ -24,6 +25,7 @@ disk_SOURCES = common.h common.c disk.c
zerolen_SOURCES = common.h common.c zerolen.c
symlink_SOURCES = common.h common.c symlink.c
volser_SOURCES = common.h common.c volser.c
+flags_SOURCES = common.h common.c flags.c
# Arrange to symlink to tests/init.sh.
CLEANFILES = init.sh
diff --git a/libparted/tests/flags.c b/libparted/tests/flags.c
new file mode 100644
index 0000000..c83a361
--- /dev/null
+++ b/libparted/tests/flags.c
@@ -0,0 +1,81 @@
+#include <config.h>
+#include <unistd.h>
+
+#include <check.h>
+
+#include <parted/parted.h>
+
+#include "common.h"
+#include "progname.h"
+
+#define STREQ(a, b) (strcmp (a, b) == 0)
+
+static char* temporary_disk;
+
+static void
+create_disk (void)
+{
+ temporary_disk = _create_disk (80 * 1024 * 1024);
+ fail_if (temporary_disk == NULL, "Failed to create temporary disk");
+}
+
+static void
+destroy_disk (void)
+{
+ unlink (temporary_disk);
+ free (temporary_disk);
+}
+
+/* TEST: Test partition type flag on gpt disklabel */
+START_TEST (test_gpt_flag)
+{
+ PedDevice* dev = ped_device_get (temporary_disk);
+ if (dev == NULL)
+ return;
+
+ PedDisk* disk = ped_disk_new_fresh (dev, ped_disk_type_get ("gpt"));
+ PedConstraint *constraint = ped_constraint_any (dev);
+ PedPartition *part = ped_partition_new (disk, PED_PARTITION_NORMAL,
+ ped_file_system_type_get("ext4"), 2048, 4096);
+ ped_partition_set_flag(part, PED_PARTITION_BIOS_GRUB, 1);
+ // Type should remain set to BIOS_GRUB
+ ped_partition_set_system(part, ped_file_system_type_get("ext4"));
+
+ ped_disk_add_partition (disk, part, constraint);
+ ped_disk_commit (disk);
+ ped_constraint_destroy (constraint);
+
+ // Check flag to confirm it is still set
+ part = ped_disk_get_partition (disk, 1);
+ fail_if (ped_partition_get_flag(part, PED_PARTITION_BIOS_GRUB) != 1, "BIOS_GRUB flag not set");
+
+ ped_disk_destroy (disk);
+ ped_device_destroy (dev);
+}
+END_TEST
+
+int
+main (int argc, char **argv)
+{
+ set_program_name (argv[0]);
+ int number_failed;
+ Suite* suite = suite_create ("Partition Flags");
+ TCase* tcase_gpt = tcase_create ("GPT");
+
+ /* Fail when an exception is raised */
+ ped_exception_set_handler (_test_exception_handler);
+
+ tcase_add_checked_fixture (tcase_gpt, create_disk, destroy_disk);
+ tcase_add_test (tcase_gpt, test_gpt_flag);
+ /* Disable timeout for this test */
+ tcase_set_timeout (tcase_gpt, 0);
+ suite_add_tcase (suite, tcase_gpt);
+
+ SRunner* srunner = srunner_create (suite);
+ srunner_run_all (srunner, CK_VERBOSE);
+
+ number_failed = srunner_ntests_failed (srunner);
+ srunner_free (srunner);
+
+ return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/libparted/tests/t1001-flags.sh b/libparted/tests/t1001-flags.sh
new file mode 100755
index 0000000..60a6248
--- /dev/null
+++ b/libparted/tests/t1001-flags.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# run the flags unittest
+
+# Copyright (C) 2007-2014, 2019-2022 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/>.
+
+. "${top_srcdir=../..}/tests/init.sh"; path_prepend_ .
+
+flags || fail=1
+
+Exit $fail
--
2.37.1

View file

@ -1,57 +0,0 @@
From 82b582996ce691eb635bed124603207515b92efe Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 8 Jan 2025 14:01:39 -0800
Subject: [PATCH 8/8] tests: Add test for dvh with a bad checksum
When using script mode it should return an unknown partition type, not
dvh, because the exception is unhandled.
---
tests/Makefile.am | 1 +
tests/t4101-dvh-badlabel.sh | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+)
create mode 100644 tests/t4101-dvh-badlabel.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 00f4a9d..5eeab08 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -71,6 +71,7 @@ TESTS = \
t4100-msdos-partition-limits.sh \
t4100-dvh-partition-limits.sh \
t4100-msdos-starting-sector.sh \
+ t4101-dvh-badlabel.sh \
t4200-partprobe.sh \
t4300-nilfs2-tiny.sh \
t4301-nilfs2-badsb2.sh \
diff --git a/tests/t4101-dvh-badlabel.sh b/tests/t4101-dvh-badlabel.sh
new file mode 100644
index 0000000..075c044
--- /dev/null
+++ b/tests/t4101-dvh-badlabel.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Test exception handling on a bad DVH disklabel
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted $srcdir
+ss=$sector_size_
+
+n_sectors=2000 # number of sectors
+dev=sun-disk-file
+# create an empty file as a test disk
+dd if=/dev/zero of=$dev bs=$ss count=$n_sectors 2> /dev/null || fail=1
+
+# label the test disk as a dvh disk
+parted -s $dev mklabel dvh > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+# Mangle the disklabel to have incorrect checksum
+dd if=/dev/zero of=$dev conv=notrunc bs=4 count=1 seek=1
+
+# Check the output (this should return 1, but depend on checking the output for the test)
+parted -m -s $dev p > out 2>&1
+grep unknown out || { cat out; fail=1; }
+
+Exit $fail
--
2.47.1

View file

@ -0,0 +1,109 @@
From 9be9067bc5a3641fc890b0d4ba994000941109bf Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 8 Aug 2022 15:02:30 -0700
Subject: [PATCH 09/10] libparted: Fix handling of msdos partition types
This restores the previous behavior by testing the partition type
against the list of known types and skipping the filesystem type reset.
Now the sequence of:
ped_partition_new(...)
ped_partition_set_flag(part, PED_PARTITION_BLS_BOOT, 1);
ped_partition_set_system(part, ped_file_system_type_get("ext4"));
Will keep the type set to PED_PARTITION_BLS_BOOT, which is how it used
to behave.
---
libparted/labels/dos.c | 54 +++++++++++++++++++++++++++++++++++-------
1 file changed, 46 insertions(+), 8 deletions(-)
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index bd7465d..4359276 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -121,6 +121,22 @@ static const struct flag_id_mapping_t flag_id_mapping[] =
{ PED_PARTITION_SWAP, PARTITION_LINUX_SWAP },
};
+static const unsigned char skip_set_system_types[] =
+{
+ PARTITION_EXT_LBA,
+ PARTITION_DOS_EXT,
+ PARTITION_COMPAQ_DIAG,
+ PARTITION_MSFT_RECOVERY,
+ PARTITION_LINUX_LVM,
+ PARTITION_LINUX_SWAP,
+ PARTITION_LINUX_RAID,
+ PARTITION_PALO,
+ PARTITION_PREP,
+ PARTITION_IRST,
+ PARTITION_ESP,
+ PARTITION_BLS_BOOT
+};
+
static const struct flag_id_mapping_t* _GL_ATTRIBUTE_CONST
dos_find_flag_id_mapping (PedPartitionFlag flag)
{
@@ -1540,6 +1556,21 @@ msdos_partition_destroy (PedPartition* part)
free (part);
}
+/* is_skip_type checks the type against the list of types that should not be
+ * overridden by set_system. It returns a 1 if it is in the list.
+*/
+static bool
+is_skip_type(unsigned char type_id) {
+ int n = sizeof(skip_set_system_types) / sizeof(skip_set_system_types[0]);
+ for (int i = 0; i < n; ++i) {
+ if (type_id == skip_set_system_types[i]) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
static int
msdos_partition_set_system (PedPartition* part,
const PedFileSystemType* fs_type)
@@ -1548,6 +1579,11 @@ msdos_partition_set_system (PedPartition* part,
part->fs_type = fs_type;
+ // Is this a type that should skip fs_type checking?
+ if (is_skip_type(dos_data->system)) {
+ return 1;
+ }
+
if (part->type & PED_PARTITION_EXTENDED) {
dos_data->system = PARTITION_EXT_LBA;
return 1;
@@ -1590,15 +1626,17 @@ msdos_partition_set_flag (PedPartition* part,
const struct flag_id_mapping_t* p = dos_find_flag_id_mapping (flag);
if (p)
{
- if (part->type & PED_PARTITION_EXTENDED)
- return 0;
-
- if (state)
- dos_data->system = p->type_id;
- else if (dos_data->system == p->type_id || dos_data->system == p->alt_type_id)
- return ped_partition_set_system (part, part->fs_type);
+ if (part->type & PED_PARTITION_EXTENDED)
+ return 0;
- return 1;
+ if (state) {
+ dos_data->system = p->type_id;
+ } else if (dos_data->system == p->type_id || dos_data->system == p->alt_type_id) {
+ // Clear the type so that fs_type will be used to return it to the default
+ dos_data->system = PARTITION_LINUX;
+ return ped_partition_set_system (part, part->fs_type);
+ }
+ return 1;
}
switch (flag) {
--
2.37.1

View file

@ -1,52 +0,0 @@
From 43c2b908396e8b7baa475e009f3f4dbf9b9beac7 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 28 May 2025 11:24:21 -0700
Subject: [PATCH 09/12] tests: probing ext4 without journal should still
indicate ext4
t1700 tests a fix for the ext filesystem probe code, it was previously
returning ext2 when the filesystem is really ext4 without a journal.
t3200 is updated to reflect the correct filesystem type -- it creates a
fs too small for a journal so it used to identify it as ext2 but now
correctly identifies it as ext4.
---
tests/t1700-probe-fs.sh | 10 ++++++++++
tests/t3200-resize-partition.sh | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh
index 7557f92..2bf2810 100755
--- a/tests/t1700-probe-fs.sh
+++ b/tests/t1700-probe-fs.sh
@@ -70,4 +70,14 @@ for feature in uninit_bg flex_bg; do
rm $dev
done
+# ext4 without a journal should still indicate ext4
+# create an ext3 file system
+dd if=/dev/null of=$dev bs=1024 seek=8192 >/dev/null || skip_ "dd failed"
+mkfs.ext4 -O ^has_journal -F $dev >/dev/null || skip_ "mkfs.ext4 failed"
+
+# probe the file system, which should still be ext4
+parted -m -s $dev u s print >out 2>&1 || fail=1
+grep '^1:.*:ext4::;$' out || fail=1
+rm $dev
+
Exit $fail
diff --git a/tests/t3200-resize-partition.sh b/tests/t3200-resize-partition.sh
index 846fbc3..c9decab 100755
--- a/tests/t3200-resize-partition.sh
+++ b/tests/t3200-resize-partition.sh
@@ -111,7 +111,7 @@ compare exp out || fail=1
parted -m -s $dev u s p > out 2>&1 || fail=1
sed -n 3p out > k && mv k out || fail=1
-printf "1:$default_start:$new_end:3073s:ext2::$ms;\n" > exp || fail=1
+printf "1:$default_start:$new_end:3073s:ext4::$ms;\n" > exp || fail=1
compare exp out || fail=1
umount "${dev}1" || fail=1
--
2.49.0

View file

@ -1,61 +0,0 @@
From e61584ddeb952ff04823936dabd1a6a241f04f38 Mon Sep 17 00:00:00 2001
From: Pascal Hambourg <pascal@plouf.fr.eu.org>
Date: Thu, 17 Apr 2025 18:42:33 +0200
Subject: [PATCH 10/12] libparted: Do not detect ext4 without journal as ext2
ext4 may have other incompatible features than journal and cannot be
mounted as ext2 by linux, so detect it as ext4 even without journal
if it has other incompatible features.
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
libparted/fs/ext2/interface.c | 33 +++++++++++++++------------------
1 file changed, 15 insertions(+), 18 deletions(-)
diff --git a/libparted/fs/ext2/interface.c b/libparted/fs/ext2/interface.c
index 7e0b197..5f64ab3 100644
--- a/libparted/fs/ext2/interface.c
+++ b/libparted/fs/ext2/interface.c
@@ -52,24 +52,21 @@ _ext2_generic_probe (PedGeometry* geom, int expect_ext_ver)
int is_ext3 = 0;
int is_ext4 = 0;
- is_ext3 = (EXT2_SUPER_FEATURE_COMPAT (*sb)
- & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0;
- if (is_ext3) {
- is_ext4 = ((EXT2_SUPER_FEATURE_RO_COMPAT (*sb)
- & EXT4_FEATURE_RO_COMPAT_HUGE_FILE)
- || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb)
- & EXT4_FEATURE_RO_COMPAT_GDT_CSUM)
- || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb)
- & EXT4_FEATURE_RO_COMPAT_DIR_NLINK)
- || (EXT2_SUPER_FEATURE_INCOMPAT (*sb)
- & EXT4_FEATURE_INCOMPAT_EXTENTS)
- || (EXT2_SUPER_FEATURE_INCOMPAT (*sb)
- & EXT4_FEATURE_INCOMPAT_64BIT)
- || (EXT2_SUPER_FEATURE_INCOMPAT (*sb)
- & EXT4_FEATURE_INCOMPAT_FLEX_BG));
- if (is_ext4)
- is_ext3 = 0;
- }
+ is_ext4 = ((EXT2_SUPER_FEATURE_RO_COMPAT (*sb)
+ & EXT4_FEATURE_RO_COMPAT_HUGE_FILE)
+ || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb)
+ & EXT4_FEATURE_RO_COMPAT_GDT_CSUM)
+ || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb)
+ & EXT4_FEATURE_RO_COMPAT_DIR_NLINK)
+ || (EXT2_SUPER_FEATURE_INCOMPAT (*sb)
+ & EXT4_FEATURE_INCOMPAT_EXTENTS)
+ || (EXT2_SUPER_FEATURE_INCOMPAT (*sb)
+ & EXT4_FEATURE_INCOMPAT_64BIT)
+ || (EXT2_SUPER_FEATURE_INCOMPAT (*sb)
+ & EXT4_FEATURE_INCOMPAT_FLEX_BG));
+ if (!is_ext4)
+ is_ext3 = (EXT2_SUPER_FEATURE_COMPAT (*sb)
+ & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0;
if (expect_ext_ver == 2 && (is_ext3 || is_ext4))
return NULL;
if (expect_ext_ver == 3 && !is_ext3)
--
2.49.0

View file

@ -0,0 +1,75 @@
From 7830678dbe832ea6815d9a31be8cbe3a67f3ed7e Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 8 Aug 2022 15:06:03 -0700
Subject: [PATCH 10/10] tests: Add a libparted test for
ped_partition_set_system on msdos
Test the libparted API to make sure the flag is not cleared by calling
ped_partition_set_system.
---
libparted/tests/flags.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/libparted/tests/flags.c b/libparted/tests/flags.c
index c83a361..c4b290b 100644
--- a/libparted/tests/flags.c
+++ b/libparted/tests/flags.c
@@ -54,6 +54,34 @@ START_TEST (test_gpt_flag)
}
END_TEST
+/* TEST: Test partition type flag on msdos disklabel */
+START_TEST (test_msdos_flag)
+{
+ PedDevice* dev = ped_device_get (temporary_disk);
+ if (dev == NULL)
+ return;
+
+ PedDisk* disk = ped_disk_new_fresh (dev, ped_disk_type_get ("msdos"));
+ PedConstraint *constraint = ped_constraint_any (dev);
+ PedPartition *part = ped_partition_new (disk, PED_PARTITION_NORMAL,
+ ped_file_system_type_get("ext4"), 2048, 4096);
+ ped_partition_set_flag(part, PED_PARTITION_BLS_BOOT, 1);
+ // Type should remain set to BIOS_GRUB
+ ped_partition_set_system(part, ped_file_system_type_get("ext4"));
+
+ ped_disk_add_partition (disk, part, constraint);
+ ped_disk_commit (disk);
+ ped_constraint_destroy (constraint);
+
+ // Check flag to confirm it is still set
+ part = ped_disk_get_partition (disk, 1);
+ fail_if (ped_partition_get_flag(part, PED_PARTITION_BLS_BOOT) != 1, "BLS_BOOT flag not set");
+
+ ped_disk_destroy (disk);
+ ped_device_destroy (dev);
+}
+END_TEST
+
int
main (int argc, char **argv)
{
@@ -61,6 +89,7 @@ main (int argc, char **argv)
int number_failed;
Suite* suite = suite_create ("Partition Flags");
TCase* tcase_gpt = tcase_create ("GPT");
+ TCase* tcase_msdos = tcase_create ("MSDOS");
/* Fail when an exception is raised */
ped_exception_set_handler (_test_exception_handler);
@@ -71,6 +100,12 @@ main (int argc, char **argv)
tcase_set_timeout (tcase_gpt, 0);
suite_add_tcase (suite, tcase_gpt);
+ tcase_add_checked_fixture (tcase_msdos, create_disk, destroy_disk);
+ tcase_add_test (tcase_msdos, test_msdos_flag);
+ /* Disable timeout for this test */
+ tcase_set_timeout (tcase_msdos, 0);
+ suite_add_tcase (suite, tcase_msdos);
+
SRunner* srunner = srunner_create (suite);
srunner_run_all (srunner, CK_VERBOSE);
--
2.37.1

View file

@ -1,61 +0,0 @@
From 2fad7d827d27e75298f1d17b5fa6567ddfc4c338 Mon Sep 17 00:00:00 2001
From: Anton Butenko <abutenko@akamai.com>
Date: Fri, 28 Feb 2025 16:09:18 +0100
Subject: [PATCH 11/12] nilfs2: Fixed possible sigsegv in case of corrupted
superblock
bytes value comes from the superblock and it must be at least as long as
s_sum which is a 32 bit value. So sumoff + 4 is the correct lower limit
for it, not sumoff - 4.
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
libparted/fs/nilfs2/nilfs2.c | 2 +-
tests/t4301-nilfs2-badsb2.sh | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/libparted/fs/nilfs2/nilfs2.c b/libparted/fs/nilfs2/nilfs2.c
index 40f8567..74186f1 100644
--- a/libparted/fs/nilfs2/nilfs2.c
+++ b/libparted/fs/nilfs2/nilfs2.c
@@ -88,7 +88,7 @@ is_valid_nilfs_sb(struct nilfs2_super_block *sb)
return 0;
bytes = PED_LE16_TO_CPU(sb->s_bytes);
- if (bytes > 1024 || bytes < sumoff - 4)
+ if (bytes > 1024 || bytes < sumoff + 4)
return 0;
crc = __efi_crc32(sb, sumoff, PED_LE32_TO_CPU(sb->s_crc_seed));
diff --git a/tests/t4301-nilfs2-badsb2.sh b/tests/t4301-nilfs2-badsb2.sh
index 2a1205b..45b6644 100755
--- a/tests/t4301-nilfs2-badsb2.sh
+++ b/tests/t4301-nilfs2-badsb2.sh
@@ -27,16 +27,22 @@ end=$(($len * 512 / $ss))
parted -s $dev mklabel msdos mkpart primary 1s ${end}s || framework_failure_
# Write a secondary superblock with the nilfs magic number and a nilfs
-# superblock length (s_bytes) field of only 10 bytes.
+# superblock length (s_bytes) field of only 13 bytes.
# struct nilfs2_super_block starts with these four fields...
# uint32_t s_rev_level;
# uint16_t s_minor_rev_level;
# uint16_t s_magic;
# uint16_t s_bytes;
sb2_offset=$(( 24 / ($ss / 512) + 1))
-perl -e "print pack 'LSSS.', 0, 0, 0x3434, 10, $ss" |
+perl -e "print pack 'LSSS.', 0, 0, 0x3434, 13, $ss" |
dd of=$dev bs=$ss seek=$sb2_offset count=1 conv=notrunc
+# Write primary nilfs magic number and a nilfs
+# superblock length (s_bytes) field of only 13 bytes.
+sb_offset=3
+perl -e "print pack 'LSSS.', 0, 0, 0x3434, 13, $ss" |
+ dd of=$dev bs=$ss seek=$sb_offset count=1 conv=notrunc
+
# This used to give parted a sigsegv.
parted -s $dev print || fail=1
--
2.49.0

View file

@ -1,90 +0,0 @@
From a2164c99b4d7d37334f9ca5ece55d8af95d002b7 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 28 May 2025 13:09:32 -0700
Subject: [PATCH 12/12] doc: Fix some groff/mandoc linting complaints
---
doc/C/parted.8 | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/doc/C/parted.8 b/doc/C/parted.8
index 171269c..c852112 100644
--- a/doc/C/parted.8
+++ b/doc/C/parted.8
@@ -54,7 +54,6 @@ Use optimum alignment as given by the disk topology information. This
aligns to a multiple of the physical block size in a way that guarantees
optimal performance.
.RE
-
.SH COMMANDS
.TP
.B [device]
@@ -62,8 +61,7 @@ The block device to be used. When none is given, \fBparted\fP will use the
first block device it finds.
.TP
.B [command [options]]
-Specifies the command to be executed. If no command is given,
-.BR parted
+Specifies the command to be executed. If no command is given, \fBparted\fP
will present a command prompt. Possible commands are:
.RS
.TP
@@ -119,8 +117,8 @@ or an LVM logical volume if necessary.
.B set \fIpartition\fP \fIflag\fP \fIstate\fP
Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP.
Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba",
-"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot", "linux-home",
-"no_automount", "bios_grub", and "palo".
+"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot",
+"linux-home", "no_automount", "bios_grub", and "palo".
\fIstate\fP should be either "on" or "off".
.TP
.B unit \fIunit\fP
@@ -140,10 +138,10 @@ On MS-DOS set the type aka. partition id of \fIpartition\fP to
the type-uuid of \fIpartition\fP to \fIuuid\fP.
.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 label you
-are using. Supported flags are: "pmbr_boot" on GPT to enable the boot flag on the
-GPT's protective MBR partition.
+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
+abel you are using. Supported flags are: "pmbr_boot" on GPT to enable the
+boot flag on the GPT's protective MBR partition.
.TP
.B disk_toggle \fIflag\fP
Toggle the state of the disk \fIflag\fP.
@@ -155,24 +153,23 @@ Display version information and a copyright message.
\fBparted\fP will compute sensible ranges for the locations you specify when using
units like "GB", "MB", etc. Use the sector unit "s" or IEC binary units like
"GiB", "MiB", to specify exact locations.
-
When you specify start or end values using IEC binary units like "MiB",
"GiB", "TiB", etc., \fBparted\fP treats those values as exact, and equivalent to
the same number specified in bytes (i.e., with the "B" suffix), in that it
provides no helpful range of sloppiness. Contrast that with a partition
start request of "4GB", which may actually resolve to some sector up to 500MB
-before or after that point. Thus, when creating a partition in an exact location
-you should use units of bytes ("B"), sectors ("s"), or IEC binary units like
-"MiB", "GiB", but not "MB", "GB", etc.
+before or after that point. Thus, when creating a partition in an exact
+location you should use units of bytes ("B"), sectors ("s"), or IEC binary units
+like "MiB", "GiB", but not "MB", "GB", etc.
.SH REPORTING BUGS
Report bugs to <bug-parted@gnu.org>
.SH SEE ALSO
.BR fdisk (8),
.BR mkfs (8),
The \fIparted\fP program is fully documented in the
-.BR info(1)
+.BR info (1)
format
-.IR "GNU partitioning software"
+.I "GNU partitioning software"
manual.
.SH AUTHOR
This manual page was written by Timshel Knoll <timshel@debian.org>,
--
2.49.0

View file

@ -1,7 +0,0 @@
--- !Policy
product_versions:
- fedora-*
decision_contexts: [bodhi_update_push_stable]
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}

View file

@ -1,8 +1,8 @@
Summary: The GNU disk partition manipulation program
Name: parted
Version: 3.6
Release: 13%{?dist}
License: GPL-3.0-or-later
Version: 3.5
Release: 6%{?dist}
License: GPLv3+
URL: http://www.gnu.org/software/parted
Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
@ -10,18 +10,18 @@ Source1: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig
Source2: pubkey.phillip.susi
Source3: pubkey.brian.lane
Patch0001: 0001-parted-Print-the-Fixing.-message-to-stderr.patch
Patch0002: 0002-doc-Document-IEC-unit-behavior-in-the-manpage.patch
Patch0003: 0003-libparted-Fail-early-when-detecting-nilfs2.patch
Patch0004: 0004-bug-74444-PATCH-parted-fix-do_version-declaration.patch
Patch0005: 0005-libparted-Fix-sun-disklabel-unhandled-exception.patch
Patch0006: 0006-tests-Add-test-for-SUN-disklabel-handling.patch
Patch0007: 0007-libparted-Fix-dvh-disklabel-unhandled-exception.patch
Patch0008: 0008-tests-Add-test-for-dvh-with-a-bad-checksum.patch
Patch0009: 0009-tests-probing-ext4-without-journal-should-still-indi.patch
Patch0010: 0010-libparted-Do-not-detect-ext4-without-journal-as-ext2.patch
Patch0011: 0011-nilfs2-Fixed-possible-sigsegv-in-case-of-corrupted-s.patch
Patch0012: 0012-doc-Fix-some-groff-mandoc-linting-complaints.patch
# Upstream patches since v3.5 release
Patch0001: 0001-maint-post-release-administrivia.patch
Patch0002: 0002-parted-add-type-command.patch
Patch0003: 0003-libparted-add-swap-flag-for-DASD-label.patch
Patch0004: 0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch
Patch0005: 0005-tests-t3200-type-change-now-passes.patch
Patch0006: 0006-disk.in.h-Remove-use-of-enums-with-define.patch
Patch0007: 0007-libparted-Fix-handling-of-gpt-partition-types.patch
Patch0008: 0008-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch
Patch0009: 0009-libparted-Fix-handling-of-msdos-partition-types.patch
Patch0010: 0010-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch
BuildRequires: gcc
BuildRequires: e2fsprogs-devel
@ -111,9 +111,9 @@ make check
%{_mandir}/man8/parted.8*
%{_mandir}/man8/partprobe.8*
%{_libdir}/libparted.so.2
%{_libdir}/libparted.so.2.0.5
%{_libdir}/libparted.so.2.0.4
%{_libdir}/libparted-fs-resize.so.0
%{_libdir}/libparted-fs-resize.so.0.0.5
%{_libdir}/libparted-fs-resize.so.0.0.4
%{_infodir}/parted.info*
%files devel
@ -126,85 +126,9 @@ make check
%changelog
* Thu Jul 24 2025 Fedora Release Engineering <releng@fedoraproject.org> - 3.6-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Fri May 30 2025 Brian C. Lane <bcl@redhat.com> - 3.6-12
- doc: Fix some groff/mandoc linting complaints (bcl)
- nilfs2: Fixed possible sigsegv in case of corrupted superblock (abutenko)
- libparted: Do not detect ext4 without journal as ext2 (pascal)
- tests: probing ext4 without journal should still indicate ext4 (bcl)
* Fri Jan 17 2025 Fedora Release Engineering <releng@fedoraproject.org> - 3.6-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Wed Jan 15 2025 Brian C. Lane <bcl@redhat.com> - 3.6-10
- tests: Add test for dvh with a bad checksum (bcl)
- libparted: Fix dvh disklabel unhandled exception (bcl)
- tests: Add test for SUN disklabel handling (bcl)
- libparted: Fix sun disklabel unhandled exception (bcl)
* Wed Nov 20 2024 Brian C. Lane <bcl@redhat.com> - 3.6-9
- parted: Fix do_version declaration (rudi)
* Thu Oct 17 2024 Brian C. Lane <bcl@redhat.com> - 3.6-8
- libparted: Fail early when detecting nilfs2 (oldium.pro)
* Fri Aug 23 2024 Brian C. Lane <bcl@redhat.com> - 3.6-7
- tests: Move to tmt tests and switch to a functional test (bcl)
* Thu Jul 18 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.6-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Tue Jul 16 2024 Brian C. Lane <bcl@redhat.com> - 3.6-5
- doc: Document IEC unit behavior in the manpage (bcl)
- parted: Print the Fixing... message to stderr (bcl)
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Mon Apr 10 2023 Brian C. Lane <bcl@redhat.com> - 3.6-1
- Upstream 3.6 stable release
- Dropping pre-3.5 changelog entries
* Mon Mar 27 2023 Brian C. Lane <bcl@redhat.com> - 3.5.28-1
- Upstream 3.5.28 Alpha release
- Dropped all patches included in new upstream release
- Bumped minor version on libparted.so and libparted-fs-resize.so
* Fri Mar 17 2023 Brian C. Lane <bcl@redhat.com> - 3.5-11
- parted: Fix ending sector location when using kibi IEC suffix (bcl)
- tests: Fix formatting and snprintf warnings in tests. (bcl)
- ui: Add checks for prompt being NULL (bcl)
- strlist: Handle realloc error in wchar_to_str (bcl)
- libparted: Fix potential NULL dereference in ped_disk_next_partition (bcl)
- filesys: Check for null from close_fn (bcl)
* Tue Feb 07 2023 Brian C. Lane <bcl@redhat.com> - 3.5-10
- libparted: Fix problem with creating 1s partitions
- tests: Fixing libparted test framework usage
* Mon Jan 30 2023 Brian C. Lane <bcl@redhat.com> - 3.5-9
- SPDX migration
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.5-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Wed Dec 14 2022 Brian C. Lane <bcl@redhat.com> - 3.5-7
- libparted: Fix handling of msdos partition types
- tests: Add a libparted test for ped_partition_set_system on msdos
- parted: Add display of GPT UUIDs in JSON output
- Add no_automount flag support
- increase xfs size to 300M
* Mon Aug 08 2022 Brian C. Lane <bcl@redhat.com> - 3.5-6
* Mon Aug 08 2022 Brian C. Lane <bcl@redhat.com> - 3.5-5.bcl.1
- Fix ped_partition_set_system handling of existing flags
Resolves: rhbz#2117048
* Thu Aug 04 2022 Brian C. Lane <bcl@redhat.com> - 3.5-5
- Update enum patch description for upstream
@ -224,3 +148,118 @@ make check
* Mon Apr 18 2022 Brian C. Lane <bcl@redhat.com> - 3.5-1
- Upstream 3.5 stable release
* Wed Mar 30 2022 Brian C. Lane <bcl@redhat.com> - 3.4.64-1
- Upstream 3.4.64 Alpha release
- Dropped all patches included in new upstream release
- Bumped minor version on libparted.so and libparted-fs-resize.so
* Thu Feb 17 2022 Brian C. Lane <bcl@redhat.com> - 3.4-12
- gnulib: Use newer cdefs.h from gnulib (bcl)
- Update parted.spec to allow flatpak builds
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.4-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Wed Oct 06 2021 Brian C. Lane <bcl@redhat.com> - 3.4-11
- docs: Update documentation to be consistent
* Wed Oct 06 2021 Brian C. Lane <bcl@redhat.com> - 3.4-10
- gpt: Revert to filesystem GUID when setting flag to off (bcl)
- tests: Add a test to make sure GPT GUIDs default to filesystem (bcl)
- doc: Document gpt linux-home flag (bcl)
- gpt: Add linux-home flag (aschnell)
- gpt: Map PED_PARTITON_ flags to GUID values (aschnell)
* Thu Sep 23 2021 Brian C. Lane <bcl@redhat.com> - 3.4-9
- keep GUID specific attributes (aschnell)
- hurd: Implement partition table rereading (cjwatson)
- hurd: Support rumpdisk-based device names (samuel.thibault)
- hurd: Fix partition paths (cjwatson)
* Wed Aug 25 2021 Brian C. Lane <bcl@redhat.com> - 3.4-8
- parted: Add --json cmdline switch to output JSON (aschnell)
- parted: Allow empty string for partition name (aschnell)
- libparted: Check devpath before passing to strlen (bcl)
* Tue Aug 10 2021 Brian C. Lane <bcl@redhat.com> - 3.4-7
- libparted: Tell libdevmapper to retry remove when BUSY (bcl)
Resolves: rhbz#1980697
- parted: Escape colons and backslashes in machine output (bcl)
- tests: check for vfat kernel support and tools (ross.burton)
- tests: add a helper to check the kernel knows about a file system (ross.burton)
- tests: add aarch64 and mips64 as a valid 64-bit machines (ross.burton)
- libparted: Add swap flag to msdos disklabel (bcl)
- Move Exception Option values into enum (bcl)
* Tue Aug 03 2021 Brian C. Lane <bcl@redhat.com> - 3.4-6
- spec: Use the %%gpgverify macro for the signature check
- tests/t3000: Use mkfs.hfsplus and fsck.hfsplus for resize tests (bcl)
- tests/t3000: Check for hfs and vfat support separately (bcl)
- tests: Reduce memory usage for tests using scsi_debug module (bcl)
- spec: Install to /usr/sbin and /usr/lib64 (bcl)
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Mon Jun 14 2021 Brian C. Lane <bcl@redhat.com> - 3.4-4
- Fix issues that covscan classifies as important
Resolves: rhbz#1938836
- Update gpg key for bcl@redhat.com
- Work around a mkswap bug
* Wed Mar 10 2021 Brian C. Lane <bcl@redhat.com> - 3.4-3
- Use autoreconf -fiv for autoconf 2.71 support
Works with both 2.69 and 2.71
* Wed Feb 03 2021 Brian C. Lane <bcl@redhat.com> - 3.4-2
- Add --fix support from upstream
* Wed Jan 27 2021 Brian C. Lane <bcl@redhat.com> - 3.4-1
- New stable upstream release v3.4
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.52-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Dec 14 2020 Brian C. Lane <bcl@redhat.com> - 3.3.52-1
- New upstream ALPHA release v3.3.52
- Includes all patches
* Mon Nov 30 2020 Brian C. Lane <bcl@redhat.com> - 3.3-8
- Add upstream commits to fix various gcc 10 warnings (bcl)
* Thu Nov 05 2020 Brian C. Lane <bcl@redhat.com> - 3.3-7
- Do not link to libselinux
* Fri Sep 25 2020 Brian C. Lane <bcl@redhat.com> - 3.3-6
- tests: Add a test for resizepart on a busy partition (bcl)
- parted: Preserve resizepart End when prompted for busy partition (bcl)
- tests: Add f2fs to the fs probe test (romain.perier)
- Add support for the F2FS filesystem (romain.perier)
- Removed reference to ped_file_system_create (max)
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jul 14 2020 Tom Stellard <tstellar@redhat.com> - 3.3-4
- Use make macros
https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
- Switch to using %%autosetup instead of %%setup and git (bcl)
- Update tests.yml to install git and simplify source usage (bgoncalv)
* Fri Mar 06 2020 Brian C. Lane <bcl@redhat.com> - 3.3-3
- Add chromeos_kernel partition flag for gpt disklabels
- Add bls_boot partition flag for msdos and gpt disklabels
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Mon Dec 16 2019 Brian C. Lane <bcl@redhat.com> - 3.3-2
- tests: Test incomplete resizepart command
- Fix end_input usage in do_resizepart
Resolves: rhbz#1701411
* Fri Oct 11 2019 Brian C. Lane <bcl@redhat.com> - 3.3-1
- New upstream release v3.3
Includes the DASD virtio-blk fix.
- Dropping pre-3.2 changelog entries

View file

@ -1,8 +0,0 @@
summary: Run a basic parted test
prepare:
how: install
package:
- parted
- jq
execute:
script: ./tests/scripts/run_tests.sh

View file

@ -1,2 +1,2 @@
SHA512 (parted-3.6.tar.xz) = 034a44b25718acba175212019d24f092972a791c5bd1d921ae91e17478657a77c5c5dd0c832bed7968c3a07ec6c65c0785acfac2f90c1ca5e1692f3c141693ef
SHA512 (parted-3.6.tar.xz.sig) = 7c845026937b29fb49085ef9e3354226b73a1c3b5f9082d440d9a8ac13d76b1d07dae0bc10d8c974d4e57bc582f38c0a908e80718dd1ff1adfad3b04699c672c
SHA512 (parted-3.5.tar.xz) = 87fc69e947de5f0b670ee5373a7cdf86180cd782f6d7280f970f217f73f55ee1b1b018563f48954f3a54fdde5974b33e07eee68c9ccdf08e621d3dc0e3ce126a
SHA512 (parted-3.5.tar.xz.sig) = 2ea1209325595416aa9ee27a0e85ca38bce50ca885d3b52ab1c1fb1b68b78d7887386ea3120274648056d2f1d9dca00b77236991765d84ad226c1b1f5a3f5c62

5
tests/provision.fmf Normal file
View file

@ -0,0 +1,5 @@
---
standard-inventory-qcow2:
qemu:
m: 4G

View file

@ -1,30 +0,0 @@
#!/usr/bin/bash
set -eux
DISK=/var/tmp/parted-disk.img
# Make a temporary disk image to use for tests
fallocate -l 100MiB $DISK
# Make a disklabel and a couple of partitions
parted -s $DISK mklabel gpt
parted -s $DISK mkpart vfat 1MiB 10MiB
parted -s $DISK mkpart ext4 10MiB 50MiB
parted -s $DISK mkpart ext4 50MiB 75MiB
parted -s $DISK set 1 boot
parted -s $DISK set 3 linux-home
# Check p1 for ESP UUID c12a7328-f81f-11d2-ba4b-00a0c93ec93b
P1_TYPE=$(parted -s $DISK --json u MiB p | jq -r '.disk.partitions[0]."type-uuid"')
[ "$P1_TYPE" == "c12a7328-f81f-11d2-ba4b-00a0c93ec93b" ] || exit 1
# Check p2 for linux data type 0fc63daf-8483-4772-8e79-3d69d8477de4
P2_TYPE=$(parted -s $DISK --json u MiB p | jq -r '.disk.partitions[1]."type-uuid"')
[ "$P2_TYPE" == "0fc63daf-8483-4772-8e79-3d69d8477de4" ] || exit 1
# Check p3 for linux home type 933ac7e1-2eb4-4f13-b844-0e14e2aef915
P3_TYPE=$(parted -s $DISK --json u MiB p | jq -r '.disk.partitions[2]."type-uuid"')
[ "$P3_TYPE" == "933ac7e1-2eb4-4f13-b844-0e14e2aef915" ] || exit 1
echo "PASS"
exit 0

29
tests/simple/run_tests.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/sh
set -eux
: ${1?"Usage: $0 TESTSDIR"}
TESTSDIR="$1"
SOURCEDIR="${TESTSDIR}/source/"
PACKAGE=parted
cd "${TESTSDIR}"
if [ ! -e ${PACKAGE}.spec ]; then
echo "Missing ${PACKAGE}.spec"
pwd
ls
exit 1
fi
# This runs from the ./tests/ directory
# Install the dependencies from the spec which MUST be copied over by tests.yml
dnf -y build-dep ${PACKAGE}.spec
# Flattened sources from standard-role-sources
cd "${SOURCEDIR}" || exit
# Rebuild the package in place, also runs the %check
# skip %prep, it was already run on the source before it was copied over
rpmbuild --noprep --nodeps -bb --build-in-place "${TESTSDIR}/${PACKAGE}.spec"
RET=$?
exit ${RET}

14
tests/tests.yml Normal file
View file

@ -0,0 +1,14 @@
---
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-source
required_packages:
- dnf
- rpm-build
- git
- role: standard-test-basic
tests:
- simple:
run: "./run_tests.sh {{ tenv_workdir }}"