From a13c518ae560f199c9c6412fa923896ec7b2a96a Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 30 May 2025 10:49:27 -0700 Subject: [PATCH 1/2] - 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) --- ...t4-without-journal-should-still-indi.patch | 52 +++++++++++ ...-detect-ext4-without-journal-as-ext2.patch | 61 +++++++++++++ ...sible-sigsegv-in-case-of-corrupted-s.patch | 61 +++++++++++++ ...some-groff-mandoc-linting-complaints.patch | 90 +++++++++++++++++++ parted.spec | 12 ++- 5 files changed, 275 insertions(+), 1 deletion(-) create mode 100644 0009-tests-probing-ext4-without-journal-should-still-indi.patch create mode 100644 0010-libparted-Do-not-detect-ext4-without-journal-as-ext2.patch create mode 100644 0011-nilfs2-Fixed-possible-sigsegv-in-case-of-corrupted-s.patch create mode 100644 0012-doc-Fix-some-groff-mandoc-linting-complaints.patch diff --git a/0009-tests-probing-ext4-without-journal-should-still-indi.patch b/0009-tests-probing-ext4-without-journal-should-still-indi.patch new file mode 100644 index 0000000..1fa6a1c --- /dev/null +++ b/0009-tests-probing-ext4-without-journal-should-still-indi.patch @@ -0,0 +1,52 @@ +From 43c2b908396e8b7baa475e009f3f4dbf9b9beac7 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +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 + diff --git a/0010-libparted-Do-not-detect-ext4-without-journal-as-ext2.patch b/0010-libparted-Do-not-detect-ext4-without-journal-as-ext2.patch new file mode 100644 index 0000000..2739563 --- /dev/null +++ b/0010-libparted-Do-not-detect-ext4-without-journal-as-ext2.patch @@ -0,0 +1,61 @@ +From e61584ddeb952ff04823936dabd1a6a241f04f38 Mon Sep 17 00:00:00 2001 +From: Pascal Hambourg +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 +--- + 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 + diff --git a/0011-nilfs2-Fixed-possible-sigsegv-in-case-of-corrupted-s.patch b/0011-nilfs2-Fixed-possible-sigsegv-in-case-of-corrupted-s.patch new file mode 100644 index 0000000..de1b0c5 --- /dev/null +++ b/0011-nilfs2-Fixed-possible-sigsegv-in-case-of-corrupted-s.patch @@ -0,0 +1,61 @@ +From 2fad7d827d27e75298f1d17b5fa6567ddfc4c338 Mon Sep 17 00:00:00 2001 +From: Anton Butenko +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 +--- + 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 + diff --git a/0012-doc-Fix-some-groff-mandoc-linting-complaints.patch b/0012-doc-Fix-some-groff-mandoc-linting-complaints.patch new file mode 100644 index 0000000..a846f6f --- /dev/null +++ b/0012-doc-Fix-some-groff-mandoc-linting-complaints.patch @@ -0,0 +1,90 @@ +From a2164c99b4d7d37334f9ca5ece55d8af95d002b7 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +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 + .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 , +-- +2.49.0 + diff --git a/parted.spec b/parted.spec index c0203d1..31ea054 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.6 -Release: 11%{?dist} +Release: 12%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -18,6 +18,10 @@ 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 BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -122,6 +126,12 @@ make check %changelog +* Fri May 30 2025 Brian C. Lane - 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 - 3.6-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From 66c2ad5f018ccccbdaa60f883675cf6c0243aba7 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 24 Jul 2025 23:58:58 +0000 Subject: [PATCH 2/2] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- parted.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parted.spec b/parted.spec index 31ea054..7948ba4 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.6 -Release: 12%{?dist} +Release: 13%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -126,6 +126,9 @@ make check %changelog +* Thu Jul 24 2025 Fedora Release Engineering - 3.6-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Fri May 30 2025 Brian C. Lane - 3.6-12 - doc: Fix some groff/mandoc linting complaints (bcl) - nilfs2: Fixed possible sigsegv in case of corrupted superblock (abutenko)