Skip to contentSkip to conversation

partx: deleting single partitions fails

DISCUSSION Ruediger Meier 2 participants 3 messages Jun 14, 2017 – Jun 15, 2017 Util-Linux package

lore
Share & tools
lore
#0 lore raw

Hi,

Looks like since commit 2d47fa39 partx does not understand single partition numbers anymore.

$ partx 2 /dev/sdb
partx: partition and disk name do not match
$ partx -d 2 /dev/sdb
partx: partition and disk name do not match

We are using the last syntax in test "delete-non-existent" but do not check stderr.

cu,
Rudi

maintainer
#1 lore raw
Quoted 2 lines · Ruediger Meier

Looks like since commit 2d47fa39 partx does not understand single partition numbers anymore.

No, this syntax is

partx <operation> <partition> <wholedisk>

where <partition> and <wholedisk> is device name, and the both paths has to match, it means

partx -d /dev/sda1 /dev/sdc

is mistake (sda vs sdc).

Quoted 2 lines
$ partx 2 /dev/sdb
partx: partition and disk name do not match

This syntax has not been supported before commit c4ecaf21d59671ac7ec0bd26bd2c346c98c7771c (year 2010) where was introduced weak code in get_partno_from_device(). This weak code cares about last number, for example "Jun2" will be interpreted as a second partition :-)

I don't think such syntax has been ever announced anywhere. The -n|--nr is required to specify partition by number.

And since 2d47fa39 we care if the <partition> exists or matches with <wholedisk>.

Quoted 2 lines
$ partx -d 2 /dev/sdb
partx: partition and disk name do not match

partx -d --nr 2 /dev/sdb

Quoted 2 lines

We are using the last syntax in test "delete-non-existent" but do not check stderr.

I don't think we need to change partx.c. IMHO the broken thing is the test and it should be fixed by "--nr" (and check stderr :-)

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com