Subject: bug#23301: I found a bug in GNU Parted 3.2

From: Luca Coianiz <[email-masked]>
Date: Sat, 16 Apr 2016 14:39:46 +0200 (CEST)

Premise: I thought my 2 disks, 1 TB each, which I assembled into a software
RAID1 /dev/md0, was not correctly added to the RAID, in details: /dev/sdb5
wasn't added as linux-swap unlike /dev/sda5, so I was trying to use parted to
make sdb5 recognized as swap, to later add it to the RAID1.

--------------------------------------------------------------------------------
[...]
(parted) select /dev/sda                                                  
Using /dev/sda
(parted) print 5                                                          
(parted) print devices                                                    
/dev/sda (1000GB)
/dev/sdb (1000GB)
/dev/md0 (998GB)
/dev/sdb5 (2123MB)
(parted) print                                                            
Model: ATA Hitachi HDT72101 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  998GB   998GB   primary                   boot, raid
 2      998GB   1000GB  2123MB  extended
 5      998GB   1000GB  2123MB  logical   linux-swap(v1)

(parted) help mkpart
  mkpart PART-TYPE [FS-TYPE] START END     make a partition

	PART-TYPE is one of: primary, logical, extended
        FS-TYPE is one of: zfs, btrfs, nilfs2, ext4, ext3, ext2, fat32, fat16,
hfsx, hfs+, hfs, jfs, swsusp, linux-swap(v1), linux-swap(v0), ntfs, reiserfs,
freebsd-ufs, hp-ufs, sun-ufs, xfs, apfs2, apfs1, asfs, amufs5, amufs4, amufs3,
amufs2, amufs1, amufs0, amufs,
        affs7, affs6, affs5, affs4, affs3, affs2, affs1, affs0, linux-swap,
linux-swap(new), linux-swap(old)
        START and END are disk locations, such as 4GB or 10%.  Negative values
count from the end of the disk.  For example, -1s specifies exactly the last
sector.
        
        'mkpart' makes a partition without creating a new file system on the
partition.  FS-TYPE may be specified to set an appropriate partition ID.
(parted) print                                                      
Backtrace has 11 calls on stack:
  11: /lib/i386-linux-gnu/libparted.so.2(ped_assert+0x51) [0xb76aadc1]
  10: /lib/i386-linux-gnu/libparted.so.2(+0x1de36) [0xb76bfe36]
  9: /lib/i386-linux-gnu/libparted.so.2(+0x1df46) [0xb76bff46]
  8: /lib/i386-linux-gnu/libparted.so.2(+0x1fc38) [0xb76c1c38]
  7: /lib/i386-linux-gnu/libparted.so.2(+0xe424) [0xb76b0424]
  6: /lib/i386-linux-gnu/libparted.so.2(ped_disk_set_flag+0x6e) [0xb76b0b5e]
  5: parted() [0x804e755]
  4: parted(interactive_mode+0x101) [0x80536c1]
  3: parted(main+0x10f4) [0x804cb14]
  2: /lib/i386-linux-gnu/i686/cmov/libc.so.6(__libc_start_main+0xf3)
[0xb74a4a63]
  1: parted() [0x804cb67]

You found a bug in GNU Parted! Here's what you have to do:

Don't panic! The bug has most likely not affected any of your data.
Help us to fix this bug by doing the following:

Check whether the bug has already been fixed by checking
the last version of GNU Parted that you can find at:

	http://ftp.gnu.org/gnu/parted/

Please check this version prior to bug reporting.

If this has not been fixed yet or if you don't know how to check,
please visit the GNU Parted website:

	http://www.gnu.org/software/parted

for further information.

Your report should contain the version of this release (3.2)
along with the error message below, the output of

	parted DEVICE unit co print unit s print

and the following history of commands you entered.
Also include any additional information about your setup you
consider important.

Assertion (part->disk->dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0) at
../../../libparted/labels/dos.c:589 in function probe_filesystem_for_geom()
failed.

Aborted                                                                   
root@home:~# parted /dev/sdb5 unit co print unit s print
Error: /dev/sdb5: unrecognised disk label
Model: Unknown (unknown)                                                  
Disk /dev/sdb5: 2123MB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 
Error: /dev/sdb5: unrecognised disk label
Model: Unknown (unknown)                                                  
Disk /dev/sdb5: 4147200s
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 
root@home:~# uname -a
Linux home 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt25-1 (2016-03-06) i686
GNU/Linux
root@home:~# 
--------------------------------------------------------------------------------

I sent this mail to the bug-parted ML, as requested, but I've not subscribed the
ML itself, so I'm available for further investigations on direct mail basis.

Luca Coianiz