Subject: print bug in probe_filesystem_for_geom

From: Tim Kissane <[email-masked]>
Date: Sat, 07 Nov 2015 15:58:52 -0500

Greetings Parted devs,

While attempting to use parted to examine a USB (/dev/sdb), I tripped a 
bug message.  I hope this information proves helpful.
My uneducated guess is that the function probe_filesystem_for_geom needs 
to validate input. Or perhaps I need to learn the right usage. ;)

---
(parted) print devices
/dev/sda (480GB)
/dev/sdb (2012MB)
(parted) print sdb
Backtrace has 11 calls on stack:
   11: /lib/x86_64-linux-gnu/libparted.so.2(ped_assert+0x44) 
[0x7fc9e17cf644]
   10: /lib/x86_64-linux-gnu/libparted.so.2(+0x1f0de) [0x7fc9e17e10de]
   9: /lib/x86_64-linux-gnu/libparted.so.2(+0x1f1e7) [0x7fc9e17e11e7]
   8: /lib/x86_64-linux-gnu/libparted.so.2(+0x209b8) [0x7fc9e17e29b8]
   7: /lib/x86_64-linux-gnu/libparted.so.2(+0x120aa) [0x7fc9e17d40aa]
   6: /lib/x86_64-linux-gnu/libparted.so.2(ped_disk_set_flag+0x68) 
[0x7fc9e17d46c8]
   5: parted() [0x406b21]
   4: parted(interactive_mode+0xff) [0x40ca2f]
   3: parted(main+0x119f) [0x405f6f]
   2: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) 
[0x7fc9e0fc6b45]
   1: parted() [0x405fc7]

You found a bug in GNU Parted! Here's what you have to do:
---
Assertion (part->disk->dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0)
at ../../../libparted/labels/dos.c:589 in function
probe_filesystem_for_geom() failed.
---
root@host:~# parted --version
parted (GNU parted) 3.2
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by 
<http://git.debian.org/?p=parted/parted.git;a=blob_plain;f=AUTHORS>.
root@host:~#
---
root@host:~# parted /dev/sdb unit co print unit s print
Model: Kingston DataTraveler 2.0 (scsi)
Disk /dev/sdb: 2012MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
  1      1049kB  2012MB  2011MB  primary  ext4         boot

Model: Kingston DataTraveler 2.0 (scsi)
Disk /dev/sdb: 3930112s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start  End       Size      Type     File system  Flags
  1      2048s  3930111s  3928064s  primary  ext4         boot

root@host:~#
---

Regards,
Tim Kissane
[email-masked]