diff --git a/0001-libfdisk-fix-last-free-sector-detection-if-partition.patch b/0001-libfdisk-fix-last-free-sector-detection-if-partition.patch new file mode 100644 index 0000000..eca67e6 --- /dev/null +++ b/0001-libfdisk-fix-last-free-sector-detection-if-partition.patch @@ -0,0 +1,42 @@ +From 430952f254cddf1ccb47a5f8caf5b5cd64193c3a Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 10 Aug 2020 11:37:32 +0200 +Subject: [PATCH] libfdisk: fix last free sector detection if partition size + specified + +We need to skip useless gaps between partition if the gap is no large +enough for a new partition. Unfortunately, the current code checks +size of the gap, but does not care for location of the gap -- this is +good enough for dialog driven partitioning, but it's pretty bad if +start of the partition is explicitly specified (e.g. sfdisk). + +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1860461 +Signed-off-by: Karel Zak +--- + libfdisk/src/dos.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c +index 176969883..890e33a26 100644 +--- a/libfdisk/src/dos.c ++++ b/libfdisk/src/dos.c +@@ -1274,14 +1274,14 @@ static int add_partition(struct fdisk_context *cxt, size_t n, + fdisk_sector_t last; + + rc = find_last_free(cxt, is_logical, start, limit, &last); +- + if (rc == 0 && last - start + 1 < fdisk_partition_get_size(pa)) { + DBG(LABEL, ul_debug("DOS: area <%ju,%ju> too small [wanted=%ju aval=%ju]", + (uintmax_t) start, (uintmax_t) last, + fdisk_partition_get_size(pa), + last - start)); + +- if (fdisk_partition_has_start(pa)) ++ if (fdisk_partition_has_start(pa) ++ && fdisk_partition_get_start(pa) <= last) + rc = -ENOSPC; + else { + start = last + 1; +-- +2.25.4 + diff --git a/libmount-remove-read-mountinfo-workaround.patch b/0002-libmount-remove-read-mountinfo-workaround.patch similarity index 100% rename from libmount-remove-read-mountinfo-workaround.patch rename to 0002-libmount-remove-read-mountinfo-workaround.patch diff --git a/util-linux.spec b/util-linux.spec index 9819085..b98ff97 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -32,6 +32,9 @@ BuildRequires: libcap-ng-devel BuildRequires: %{pypkg}-devel BuildRequires: pcre2-devel BuildRequires: gcc +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool %ifarch ppc64le BuildRequires: librtas-devel %endif @@ -101,9 +104,11 @@ Requires: libfdisk = %{version}-%{release} ### # 151635 - makeing /var/log/lastlog Patch0: 2.36-login-lastlog-create.patch +# 1860461 - sfdisk regression creating simple 3 partition MBR disk +Patch1: 0001-libfdisk-fix-last-free-sector-detection-if-partition.patch # https://github.com/karelzak/util-linux/commit/57898c3a7ee8fc5933cddd4526bb3980bef85a02 # The workaround is unnecessary on Fedora with kernel >= 5.8. -Patch1: libmount-remove-read-mountinfo-workaround.patch +Patch2: 0002-libmount-remove-read-mountinfo-workaround.patch %description The util-linux package contains a large variety of low-level system @@ -938,6 +943,7 @@ fi %changelog * Tue Sep 01 2020 Karel Zak - 2.36-3 - remove mountinfo workaround (unnecessary for kernel 5.8) +- fix #1860461 - sfdisk regression creating simple 3 partition MBR disk * Wed Jul 29 2020 Fedora Release Engineering - 2.36-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild