Subject: `parted --list` segmentation fault

From: Matthew Hoare <[email-masked]>
Date: Sun, 21 Jun 2020 08:31:44 +0100

Parted version:
===========

3.3

Distribution:
=========

Alpine Linux (musl libc base)

Hard drives:
========

/dev/sda (500GB, rotational), /dev/nvme0n1 (250GB, SSD)

Steps to reproduce:
==============

Run `parted --list`

Full error message:
==============

~# parted --list
Model: ATA HGST HTS545050A7 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End    Size   File system  Name              Flags
 1      1049kB  268GB  268GB  xfs          Linux filesystem
 2      268GB   500GB  232GB  xfs          Linux filesystem

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.3)
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.

Command History:
Segmentation fault
~139#

Requested output:
=============

~# parted /dev/sda unit co print unit s print
Model: ATA HGST HTS545050A7 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End    Size   File system  Name              Flags
 1      1049kB  268GB  268GB  xfs          Linux filesystem
 2      268GB   500GB  232GB  xfs          Linux filesystem

Model: ATA HGST HTS545050A7 (scsi)
Disk /dev/sda: 976773168s
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start       End         Size        File system  Name              Flags
 1      2048s       524290047s  524288000s  xfs          Linux filesystem
 2      524290048s  976773134s  452483087s  xfs          Linux filesystem

~# parted /dev/nvme0n1 unit co print unit s print
Model: SAMSUNG MZVLB256HAHQ-000L7 (nvme)
Disk /dev/nvme0n1: 256GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system     Name              Flags
 1      1049kB  538MB   537MB   fat32           EFI System        boot, esp
 2      538MB   9128MB  8590MB  linux-swap(v1)  Linux swap        swap
 3      9128MB  256GB   247GB   btrfs           Linux filesystem

Model: SAMSUNG MZVLB256HAHQ-000L7 (nvme)
Disk /dev/nvme0n1: 500118192s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start      End         Size        File system     Name
      Flags
 1      2048s      1050623s    1048576s    fat32           EFI System
      boot, esp
 2      1050624s   17827839s   16777216s   linux-swap(v1)  Linux swap
      swap
 3      17827840s  500118158s  482290319s  btrfs           Linux filesystem

~#

Other information:
=============

The error code is "139" (as can be seen in the prompt after the error message).

I tried to reproduce this through gdb but parted works fine when
invoked in interactive mode, it only fails when the --list option is
passed.