[parted-devel] [PATCH v2] parted/ui: Count empty quoted strings as words in multi_word mode

Sebastian Parschauer sparschauer at suse.de
Mon Sep 4 07:30:29 UTC 2017


On 01.09.2017 21:25, Phil Susi wrote:
> On 8/11/2017 10:55 AM, Sebastian Parschauer wrote:
>> The quoting is required as in interactive mode the command
>> "mkpart " (with a trailing space) would set the partition name to
>> an empty string already.
> 
> I'm not sure I understand what the problem was, but it seems like it
> should be fixable without resorting to quoting quotes.
> 
> Do you mean that if you literally type ( with the quotes ) "mkpart ",
> then the space between the mkpart and end quote is considered an empty
> string because it is somewhere within quotes?  It doesn't seem like it
> should be too hard to only consider quotes with nothing between them to
> be an empty string.

It is the same problem as with partition names containing a space. The
outer quotes are used to pass the string inside them to interactive mode
interpreter. So using just "" results in no string/quotes required at
all in interactive mode. So any space would set the partition name to an
empty string already. If completion is used as for "mkp<tab>", then the
space at the end of the command is added and that shouldn't set the
partition name to an empty string already.

(parted) mkpart <enter>
File system type?  [ext2]?

You can check v1 for that bug.

The interactive mode also has the possibility to use multi word parsing.
So only v2 does it correctly.

Script mode:
parted -s /dev/vdb mkpart "''" 0% 100%

Interactive mode:
(parted) mkpart '' 0% 100%

So the quoting quotes is required in script mode like it is required for
strings containing a space like the partition name "'Linux Filesystem'"
which is set by gdisk.



More information about the parted-devel mailing list