[Parted-maintainers] Bug#835172: parted: incorrectly reports the location is outside of the device

Tom Vajzovic t.debbugs at purposeful.co.uk
Tue Aug 23 08:28:27 UTC 2016


Package: parted
Version: 3.2-15
Severity: normal

Dear Maintainer,

Parted incorrectly reports "The location xxx is outside of the device"
when trying to make a partition finish at the exact end of a device.

To reproduce, run the following commands:

rm -f blockfile
truncate -s 100M blockfile
/sbin/parted -s blockfile mklabel msdos
/sbin/parted -s blockfile unit MiB mkpart primary fat16 1 50
/sbin/parted -s blockfile unit MiB mkpart primary fat16 50 100
/sbin/parted -s blockfile unit s print

Note that only one partition is created, the second mkpart fails with:
Error: The location 100 is outside of the device /home/tcv/blockfile.

The correct behaviour can be observed by the following commands:

rm -f blockfile
truncate -s 101M blockfile
/sbin/parted -s blockfile mklabel msdos
/sbin/parted -s blockfile unit MiB mkpart primary fat16 1 50
/sbin/parted -s blockfile unit MiB mkpart primary fat16 50 100
truncate -s 100M blockfile
/sbin/parted -s blockfile unit s print

By making the device (in this case a disk image file) bigger than
necessary, parted correctly allows the partition to be created.
The size can then be reduced, and the print command shows what the
output should have been in the first case.

A more concise workaround uses percentages:

rm -f blockfile
truncate -s 100M blockfile
/sbin/parted -s blockfile mklabel msdos
/sbin/parted -s blockfile unit MiB mkpart primary fat16 1 50
/sbin/parted -s blockfile unit MiB mkpart primary fat16 50 '100%'
/sbin/parted -s blockfile unit s print

The output in either of the two workarounds is the same, it should be
the same for the problem case too.  Presumably a < needs to be changed
to <= somewhere.

Many thanks,
Tom

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 4.6.0-1-amd64 (SMP w/12 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages parted depends on:
ii  libc6         2.23-4
ii  libparted2    3.2-15
ii  libreadline6  6.3-8+b4
ii  libtinfo5     6.0+20160625-1

parted recommends no packages.

Versions of packages parted suggests:
pn  parted-doc  <none>

-- no debconf information



More information about the Parted-maintainers mailing list