Only read partition table after not finding a whole disk file system (#771244)
ISO9660 images can contain embedded partitions which when encountered on whole disk drives causes libparted to report various warnings and errors. For example on CentOS 6 with upgraded libparted 2.4 the following errors and warnings are encountered with various ISO images. (Deliberately using an older distribution with older blkid to avoid another issue with blkid addressed in the following patch). Libparted error message 1: # wget http://git.kernel.org/cgit/utils/util-linux/util-linux.git/plain/tests/ts/isosize/sample.iso.gz # dd if=/dev/zero bs=1M of=/dev/sdc # zcat sample.iso.gz | dd of=/dev/sdc # blkid -v blkid from util-linux-ng 2.17.2 (libblkid 2.17.0, 22-Mar-2010) # blkid | fgrep /dev/sdc /dev/sdc: LABEL="ARCH_201301" TYPE="iso9660" # ./gpartedbin /dev/sdc ====================== libparted : 2.4 ====================== Invalid partition table - recursive partition on /dev/sdc. Libparted Error (-) Invalid partition table - recursive partition on /dev/sdc. [ Cancel ] [ Ignore ] Libparted error message 2: # wget http://cdimage.debian.org/debian-cd/8.6.0/amd64/iso-cd/debian-8.6.0-amd64-netinst.iso # dd if=/dev/zero bs=1M of=/dev/sdc # dd if=debian-8.6.0-amd64-netinst.iso bs=1M of=/dev/sdc # blkid | fgrep /dev/sdc /dev/sdc: LABEL="Debian 8.6.0 amd64 1" TYPE="iso9660" # ./gpartedbin /dev/sdc ====================== libparted : 2.4 ====================== /dev/sdc contains GPT signatures, indicating that it has a GPT table. However, it does not have a valid fake msdos partition table, as it should. Perhaps it was corrupted -- possibly by a program that doesn't understand GPT partition tables. Or perhaps you deleted the GPT table, and are now using an msdos partition table. Is this a GPT partition table? Libparted Warning /!\ /dev/sdc contains GPT signatures, indicating that it has a GPT table. However, it does not have a valid fake msdos partition table, as it should. Perhaps it was corrupted -- possibly by a program that doesn't understand GPT partition tables. Or perhaps you deleted the GPT table, and are now using an msdos partition table. Is this a GPT partition table? [ Yes ] [ No ] These messages are because GParted is calling ped_disk_new() to attempt to read the partition table even before it has tried to recognise the ISO9660 file system on the whole disk drive. Full call chain is: set_devices_thread() set_device_from_disk() get_device_and_disk() get_disk() ped_disk_new() Fix this by delaying the call to ped_disk_new() until after whole disk drive recognition has been performed. Replace combined get_device_and_disk() with separate get_device() and only call get_disk() after no whole disk drive file system has been recognised. This is similar to how calibrate_partition() and erase_filesystem_signatures() are structured to also handle whole disk drive file systems. Bug 771244 - gparted does not recognize the iso9660 file system in cloned Ubuntu USB boot drives
parent
fd426cf3