Subject: bug#23296: parted 3.2 (libparted) , mklabel sun, bug, sparc64

From: Anatoly Pugachev <[email-masked]>
Date: Fri, 15 Apr 2016 16:35:00 +0300

Hello!

I can't make sun partition table with parted over existing one on
debian sparc64 physical machine Sun SPARC T5120:

root@nvg5120:~# parted /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit co
(parted) print
Warning: The disk CHS geometry (17848,255,63) reported by the
operating system does not match the geometry stored on the disk label
(65535,16,273).
Ignore/Cancel? I
Model: SEAGATE ST914602SSUN146G (scsi)
Disk /dev/sda: 147GB
Sector size (logical/physical): 512B/512B
Partition Table: sun
Disk Flags:

Number  Start   End     Size    File system  Flags
 1      0.00B   16.1GB  16.1GB  sun-ufs      root
 2      16.1GB  33.3GB  17.2GB
 4      33.3GB  49.4GB  16.1GB  sun-ufs
 5      49.4GB  146GB   97.0GB  sun-ufs

(parted) unit s
(parted) print
Model: SEAGATE ST914602SSUN146G (scsi)
Disk /dev/sda: 286739329s
Sector size (logical/physical): 512B/512B
Partition Table: sun
Disk Flags:

Number  Start      End         Size        File system  Flags
 1      0s         31458335s   31458336s   sun-ufs      root
 2      31458336s  65013311s   33554976s
 4      65013312s  96471647s   31458336s   sun-ufs
 5      96471648s  285837551s  189365904s  sun-ufs

(parted)
(parted) mklabel sun
Warning: The existing disk label on /dev/sda will be destroyed and all
data on this disk will be lost. Do you want to continue?
Yes/No? Yes
Backtrace has 1 calls on stack:
  1: /lib/sparc64-linux-gnu/libparted.so.2(ped_assert+0x2c) [0xffff8001001344c4]

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

Assertion (bios_geom->cylinders == (PedSector) (dev->length /
cyl_size)) at ../../../libparted/labels/sun.c:190 in function
sun_alloc() failed.

Aborted

PS: OS is Linux debian sid/unstable (kernel 4.5 , glibc 2.22) sparc64.