[Parted-maintainers] Bug#826863: gnu-fdisk: makes partition table inside partition without warning

Wookey wookey at wookware.org
Thu Jun 9 15:35:52 UTC 2016


Package: gnu-fdisk
Version: 1.2.4-3.1
Severity: wishlist

Dear Maintainer,

If you foolishly type "cfdisk /dev/sdc1" when you really meant "cfdisk
/dev/sdc", the tool will happily show a normal-looking partition table
and let you change the type (e.g. from DOS (06) to ext2 (83), and then
will save the table inside the partition (as opposed to at the start
of the drive).

At no point in this process do you get any warning saying "are you
really sure you want to do that, it's practically guaranteed to be
wrong".

Doing this, you end up with a partition table (reporting one DOS
partition) remaining at the start of /dev/sdc, and a second partition
table (reporting one ext2 partition) at the start of /dev/sdc1.

Perhaps surprisingly, mounting /dev/sdc1 (with pmount sdc1) works fine (as
ext2) so at no point in this process do you notice that you've made a
very odd (arguably 'illegal') disk layout.

It would be useful if cfdisk complained that writing a partition table
into a partition, rather than onto the start of a
device/block-device/file is probably a bad idea. I realise that
sometimes it is entirely legitmately given a file or loopback block
device, so it may be a bit tricky to get this right, but it should be
able to do some sanity checks about writing the partition table inside
a partition on the (parent) device, especially when that partent
device already has a partition table. Obviously we don't want it
moaning often about things that are OK, but a warning for
partition-table-inside-partition seems like a good idea. 

My tests were done on a plain single-parttion DOS-format SD card.

-- System Information:
Debian Release: 8.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/8 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 gnu-fdisk depends on:
ii  dpkg               1.17.27
ii  install-info       5.2.0.dfsg.1-6
ii  libc6              2.19-18+deb8u4
ii  libncurses5        5.9+20140913-1+b1
pn  libparted0debian1  <none>
ii  libreadline6       6.3-8+b3
ii  libuuid1           2.25.2-6

gnu-fdisk recommends no packages.

gnu-fdisk suggests no packages.



More information about the Parted-maintainers mailing list