Bug 1860461 - sfdisk regression creating simple 3 partition MBR disk
Summary: sfdisk regression creating simple 3 partition MBR disk
Alias: None
Product: Fedora
Classification: Fedora
Component: util-linux
Version: 33
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Karel Zak
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: TRACKER-bugs-affecting-libguestfs
TreeView+ depends on / blocked
Reported: 2020-07-24 16:35 UTC by Richard W.M. Jones
Modified: 2020-09-01 12:31 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2020-09-01 12:31:45 UTC
Type: Bug

Attachments (Terms of Use)

Description Richard W.M. Jones 2020-07-24 16:35:13 UTC
Description of problem:

One of the nbdkit tests is failing after upgrading util-linux to 2.36-1.fc33:

Here's a simple reproducer using 2 commands:

$ truncate -s 1G disk
$ echo -e '2048 1023 L -\n4096 4095 L -\n8192 8191 L -\n' | sfdisk -X dos disk
Checking that no-one is using this disk right now ... OK

Disk disk: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

>>> Created a new DOS disklabel with disk identifier 0x4d24f754.
disk1: Created a new partition 1 of type 'Linux' and of size 511.5 KiB.
disk2: Created a new partition 2 of type 'Linux' and of size 2 MiB.
disk3: No free sectors available.
Failed to add #3 partition: No space left on device

When the same two commands are run on util-linux-2.35.2-1.fc32 it
does not fail.

Version-Release number of selected component (if applicable):

util-linux to 2.36-1.fc33 (all architectures)

How reproducible:


Steps to Reproduce:
1. See above.

Comment 1 Richard W.M. Jones 2020-07-24 16:46:23 UTC
git bisect sayeth:

83fdb880b953164fec7cc603c4ece11cb78762db is the first bad commit
commit 83fdb880b953164fec7cc603c4ece11cb78762db
Author: Karel Zak <kzak@redhat.com>
Date:   Thu May 21 15:37:59 2020 +0200

    libfdisk: (dos) fix default partition start
    The current code implements the default start as first free space, but
    it does not check if the space is large enough.
    Addresses: https://github.com/karelzak/util-linux/issues/1044
    Signed-off-by: Karel Zak <kzak@redhat.com>

 libfdisk/src/alignment.c |  6 ++--
 libfdisk/src/dos.c       | 81 +++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 79 insertions(+), 8 deletions(-)

Comment 2 Karel Zak 2020-08-10 09:47:33 UTC
Oh, this is stupid bug. Sorry.

Fixed by upstream commit https://github.com/karelzak/util-linux/commit/4fe7f9b614e2b5bb97f6d89af02acb867cffccc1

The Fedora package will be updated ASAP. 

Thanks for your report!

Comment 3 Richard W.M. Jones 2020-08-10 10:49:54 UTC
Hey no problem, I'll check the fix when I see the new build in Fedora.

Comment 4 Ben Cotton 2020-08-11 13:49:27 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 33 development cycle.
Changing version to 33.

Comment 5 Richard W.M. Jones 2020-09-01 11:05:02 UTC
Could you add this bug fix to Rawhide too?  At the moment it's only
present on the F33 branch and Rawhide has a different -3 package.

Comment 6 Richard W.M. Jones 2020-09-01 12:31:45 UTC
Can confirm this is fixed now, thanks.

Note You need to log in before you can comment on or make changes to this bug.