Maxim Perevedentsev
2015-Dec-09 12:36 UTC
[Libguestfs] Bug: part_set_name does not enquote name
Windows server 2012 sets partition names with spaces. ><fs> part-get-name /dev/sda 3 libguestfs: trace: part_get_name "/dev/sda" 3 guestfsd: main_loop: new request, len 0x38 parted -s -m /dev/null Error: The device /dev/null is so small that it cannot possibly store a file system or partition table. Perhaps you selected the wrong device? Warning: Error fsyncing/closing /dev/null: Invalid argument parted -m -- /dev/sda unit b print parted -m -- /dev/sda unit b print libguestfs: trace: part_get_name = "Basic data storage" Basic data storage ><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 Usage: parted [OPTION]... [DEVICE [COMMAND [PARAMETERS]...]...] Apply COMMANDs with PARAMETERS to DEVICE. If no COMMAND(s) are given, run in interactive mode. OPTIONs: -h, --help displays this help message -l, --list lists partition layout on all block devices -m, --machine displays machine parseable output -s, --script never prompts for user intervention -v, --version displays the version -a, --align=[none|cyl|min|opt] alignment for new partitions COMMANDs: align-check TYPE N check partition N for TYPE(min|opt) alignment help [COMMAND] print general help, or help on COMMAND mklabel,mktable LABEL-TYPE create a new disklabel (partition table) mkpart PART-TYPE [FS-TYPE] START END make a partition name NUMBER NAME name partition NUMBER as NAME print [devices|free|list,all|NUMBER] display the partition table, available devices, free space, all found partitions, or a particular partition quit exit program rescue START END rescue a lost partition near START and END rm NUMBER delete partition NUMBER select DEVICE choose the device to edit disk_set FLAG STATE change the FLAG on selected device disk_toggle [FLAG] toggle the state of FLAG on selected device set NUMBER FLAG STATE change the FLAG on partition NUMBER toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER unit UNIT set the default unit to UNIT version display the version number and copyright information of GNU Parted Report bugs to bug-parted@gnu.org udevadm --debug settle calling: settle libguestfs: trace: part_set_name = 0 ><fs> part-get-name /dev/sda 3 libguestfs: trace: part_get_name "/dev/sda" 3 guestfsd: main_loop: new request, len 0x38 parted -s -m /dev/null Error: The device /dev/null is so small that it cannot possibly store a file system or partition table. Perhaps you selected the wrong device? Warning: Error fsyncing/closing /dev/null: Invalid argument parted -m -- /dev/sda unit b print parted -m -- /dev/sda unit b print libguestfs: trace: part_get_name = "Basic" Basic -- С уважением, Максим Переведенцев Your sincerely, Maxim Perevedentsev
Maxim Perevedentsev
2015-Dec-16 12:17 UTC
Re: [Libguestfs] Bug: part_set_name does not enquote name
On 12/09/2015 03:36 PM, Maxim Perevedentsev wrote:> Windows server 2012 sets partition names with spaces. > > ><fs> part-get-name /dev/sda 3 > libguestfs: trace: part_get_name "/dev/sda" 3 > guestfsd: main_loop: new request, len 0x38 > parted -s -m /dev/null > Error: The device /dev/null is so small that it cannot possibly store > a file system or partition table. Perhaps you selected the wrong device? > Warning: Error fsyncing/closing /dev/null: Invalid argument > parted -m -- /dev/sda unit b print > parted -m -- /dev/sda unit b print > libguestfs: trace: part_get_name = "Basic data storage" > Basic data storage > > ><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 > Usage: parted [OPTION]... [DEVICE [COMMAND [PARAMETERS]...]...] > Apply COMMANDs with PARAMETERS to DEVICE. If no COMMAND(s) are given, > run in > interactive mode. > > OPTIONs: > -h, --help displays this help message > -l, --list lists partition layout on all block > devices > -m, --machine displays machine parseable output > -s, --script never prompts for user intervention > -v, --version displays the version > -a, --align=[none|cyl|min|opt] alignment for new partitions > > COMMANDs: > align-check TYPE N check partition N for > TYPE(min|opt) alignment > help [COMMAND] print general help, or help > on COMMAND > mklabel,mktable LABEL-TYPE create a new disklabel > (partition table) > mkpart PART-TYPE [FS-TYPE] START END make a partition > name NUMBER NAME name partition NUMBER as NAME > print [devices|free|list,all|NUMBER] display the partition > table, available devices, free space, all found partitions, or a > particular partition > quit exit program > rescue START END rescue a lost partition > near START and END > rm NUMBER delete partition NUMBER > select DEVICE choose the device to edit > disk_set FLAG STATE change the FLAG on selected > device > disk_toggle [FLAG] toggle the state of FLAG on > selected device > set NUMBER FLAG STATE change the FLAG on > partition NUMBER > toggle [NUMBER [FLAG]] toggle the state of FLAG on > partition NUMBER > unit UNIT set the default unit to UNIT > version display the version number > and copyright information of GNU Parted > > Report bugs to bug-parted@gnu.org > udevadm --debug settle > calling: settle > libguestfs: trace: part_set_name = 0 > > ><fs> part-get-name /dev/sda 3 > libguestfs: trace: part_get_name "/dev/sda" 3 > guestfsd: main_loop: new request, len 0x38 > parted -s -m /dev/null > Error: The device /dev/null is so small that it cannot possibly store > a file system or partition table. Perhaps you selected the wrong device? > Warning: Error fsyncing/closing /dev/null: Invalid argument > parted -m -- /dev/sda unit b print > parted -m -- /dev/sda unit b print > libguestfs: trace: part_get_name = "Basic" > BasicJust to remind, this is an irritating issue, and I'd like it to be fixed although I do not know exactly how. Should I create a bug in RHBZ? Thank you! -- Your sincerely, Maxim Perevedentsev
Richard W.M. Jones
2015-Dec-16 14:41 UTC
Re: [Libguestfs] Bug: part_set_name does not enquote name
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 storageNote 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
Apparently Analagous Threads
- [PATCH v4 0/7] virt-resize: add support for resizing logical partitions
- [PATCH 0/3] virt-resize: preserve GPT partitions label
- Re: Bug: windows server 2012R2 fails to start after virt-resize
- Bug: windows server 2012R2 fails to start after virt-resize
- [PATCH v2 0/3] copying gpt attributes