[Libguestfs] Bug: part_set_name does not enquote name

Richard W.M. Jones rjones at redhat.com
Wed Dec 16 14:41:55 UTC 2015


On Wed, Dec 09, 2015 at 03:36:08PM +0300, Maxim Perevedentsev wrote:
> ><fs> part-set-name /dev/sda 3 'Basic data storage'
> libguestfs: trace: part_set_name "/dev/sda" 3 "Basic data storage"
> guestfsd: main_loop: proc 416 (part_get_name) took 0.01 seconds
> guestfsd: main_loop: new request, len 0x50
> udevadm --debug settle
> calling: settle
> parted -s -- /dev/sda name 3 Basic data storage

Note the debug message here could be confusing.  We're not really
running the parted command with no quoting.  In reality it is run
using execvp(3) so individual parameters do not need to be quoted.

Anyway, this is reproducible for me.  The one line reproducer is:

  guestfish -N disk part-disk /dev/sda gpt : part-set-name /dev/sda 1 "foo bar"

(add -v -x to see the error message from parted).

However it seems to be a bug in parted itself.  I get exactly the same
thing if I run parted from the command line on a GPT disk:

# parted -s /dev/sda name 1 "foo bar"
Usage: parted [OPTION]... [DEVICE [COMMAND [PARAMETERS]...]...]
Apply COMMANDs with PARAMETERS to DEVICE.  If no COMMAND(s) are given, run in
interactive mode.

OPTIONs:
[etc]

whereas using a name without spaces works fine.

So, I think it's a bug or limitation of parted, unless I get other
information.

(Provided that GPT partitions are allowed to contain spaces of course)

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list