GNU bug report logs - #54835
Inconsistent interpretation of end specifications

Previous Next

Package: parted;

Reported by: Joshua Krämer <joshua <at> kraemer.link>

Date: Sun, 10 Apr 2022 12:24:01 UTC

Severity: normal

To reply to this bug, email your comments to 54835 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-parted <at> gnu.org:
bug#54835; Package parted. (Sun, 10 Apr 2022 12:24:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Joshua Krämer <joshua <at> kraemer.link>:
New bug report received and forwarded. Copy sent to bug-parted <at> gnu.org. (Sun, 10 Apr 2022 12:24:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Joshua Krämer <joshua <at> kraemer.link>
To: bug-parted <at> gnu.org
Subject: Inconsistent interpretation of end specifications
Date: Sun, 10 Apr 2022 13:47:33 +0200
Dear parted developers,

the mkpart end specification seems to be interpreted differently
depending on the given unit. If the end location is given in s, B or
KiB, it seems to be interpreted as the offset of the partition's last
sector:

| $ parted test.img
| WARNING: You are not superuser.  Watch out for permissions.
| GNU Parted 3.4
| Using /home/joshua/parted/test.img
| Welcome to GNU Parted! Type 'help' to view a list of commands.
| (parted) mkpart test 2048s 4096s
| (parted) unit s
| (parted) print
| Model:  (file)
| Disk /home/joshua/parted/test.img: 6144s
| Sector size (logical/physical): 512B/512B
| Partition Table: gpt
| Disk Flags:
|
| Number  Start  End    Size   File system  Name  Flags
|  1      2048s  4096s  2049s               test

"mkpart test 1048576B 2097152B" and "mkpart test 1024KiB 2048KiB" give
the same result. However, if the end is specified in MiB, it seems to
be interpreted as the offset of the first sector after the partition's
end:

| (parted) mkpart test 1MiB 2MiB
| (parted) print
| Model:  (file)
| Disk /home/joshua/parted/test.img: 6144s
| Sector size (logical/physical): 512B/512B
| Partition Table: gpt
| Disk Flags:
|
| Number  Start  End    Size   File system  Name  Flags
|  1      2048s  4095s  2048s               test

The meaning of the end specification with the print command seems to
be different as well. I think it represents the offset of the first
sector after the partition's end minus 1 unit (rounded):

| (parted) mkpart test 1048576B 2097152B
| (parted) unit B
| (parted) print
| Model:  (file)
| Disk /home/joshua/parted/test.img: 3145728B
| Sector size (logical/physical): 512B/512B
| Partition Table: gpt
| Disk Flags:
|
| Number  Start     End       Size      File system  Name  Flags
|  1      1048576B  2097663B  1049088B               test

If there is a reason for these inconsistencies, I think they should be
clearly described in the documentation.

Thanks for your work and kind regards,
Joshua Krämer




This bug report was last modified 2 years and 228 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.