GNOME Bugzilla – Bug 649509
Problems with space in device name and mkfs
Last modified: 2017-09-21 21:38:19 UTC
I am using fakeRaid and gave the array a name with an space in it. This results in a device adress like "/dev/mapper/blahblahmy raid" GParted was unable to create a partition with mkfs(ext4) because the device adress was not quoted. Example of executed command (by gparted): mkfs.ext4 -j -O extent -L "" /dev/mapper/blahblahmy raid ==> mkfs.ext4: invalid blocks count 'raid' on device '/dev/mapper/blahblahmy'
Created attachment 188814 [details] Problem with space in name Problem in space. I manually copied command line and added quote's mark. Partition created successfully.
Thank you for reporting this problem and testing a potential solution. Obviously you have been able to place a space in a device name and use the device. My question is whether it is valid to have a space in a device name?
I think yes, it's valid name. Because a BIOS permits creating such name, Windows and Jmicrons software worked with such name without problem. In any case, if it isn't a valid name, a GParted must give warning/error messages about wrong name and recommendation to remove a space, not silently goes down. Sorry for delay with answer.
Actually it looks like this is a bug in (lib)parted rather than gparted.
Actually the bug turns out to be in libdevmapper. If you run dmsetup create 'foo bar' it ends up creating /dev/mapper/foo\x20bar instead. IMHO, this is a mistake right there, but then when you run parted on that, dm_task_get_name() unescapes it and tells libparted the name of the device is "foo bar". This causes libparted to fail to add/remove/set the type of partitions, which prevents gparted from even trying to run mkfs, so perhaps I am seeing a second bug in addition to gparted failing to quote or escape the name when passing it to mkfs. I have emailed the lvm devel mailing list about it.
My report is a few years old, so I'm having a hard time to remember under which circumstances the error occurred. I'm pretty sure that I configured the name in the BIOS/jmicron(?) settings, very similar to Mogols example and that the fix in this case was to add the quotes to the mkfs command and run it manually. Thumbs up for looking after such an old bug and potentially finding a new one in libdevmapper!
Just pushed the patchset to fix bug 787203 "Correctly quote and escape arguments of external programs passed to execute_command()". It has the effect of enclosing all device names in single quotes, thus allowing device names containing spaces to be used with GParted. Therefore closing this report as a duplicate of 787203. *** This bug has been marked as a duplicate of bug 787203 ***