Subject: parted name fails on names with spaces

From: Nathan Craike <[email-masked]>
Date: Thu, 30 Nov 2017 12:08:04 +1000

Hi,

I'm using GNU parted 3.2 running on Ubuntu 16.04.3 LTS. The machine is
an Amazon EC2 instance (ie a virtual server) launched from Ubuntu's
official 16.04 Amazon machine image (AMI).

I'm trying to use parted to add a name to a disk partition. I'm not
sure if it's of note, but this is a virtual disk attached to my EC2
instance (an "EBS volume" in Amazon terms). The disk in question is
device "/dev/xvdb". I've already created the partition with:

parted /dev/xvdb mklabel gpt
parted /dev/xvdb mkpart primary ext4 0% 100% --align=optimal
mkfs.ext4 -L 'Some other label' /dev/xvdb1

At this stage, "parted /dev/xvdb print" outputs:

parted /dev/xvdb print
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdb: 5369MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  5368MB  5367MB  ext4         primary

If I then try to add to partition 1 a name which contains spaces using
quotes, parted either prints its usage message or interactively
prompts for the partition number and name. However, in either case
parted seems to have applied the first word name given. Examples:

------------------------------------------------------

$ sudo parted /dev/xvdb name 1 'Secret Documents'
Usage: parted [OPTION]... [DEVICE [COMMAND [PARAMETERS]...]...]
Apply COMMANDs with PARAMETERS to DEVICE.  If no COMMAND(s) are given, run in
interactive mode.

OPTIONs:
---x--- (more of the usage message removed)
  version                                  display the version number
and copyright information of GNU Parted

Report bugs to [email-masked]

$ sudo parted /dev/xvdb print
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdb: 5369MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name    Flags
 1      1049kB  5368MB  5367MB  ext4         Secret

------------------------------------------------------

$ sudo parted /dev/xvdb name 1 'My Name'
Partition number? ^C
Error: Expecting a partition number.

$ sudo parted /dev/xvdb print
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdb: 5369MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  5368MB  5367MB  ext4         My

------------------------------------------------------

The first example is the same as that given in the documentation at
https://www.gnu.org/software/parted/manual/html_node/name.html

Apologies if I'm misunderstanding the documentation, if this is a
known bug, or if this is something introduced upstream.

Regards,
Nathan Craike