[gparted] Quote mount point when resizing nilfs2 (#782681)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Quote mount point when resizing nilfs2 (#782681)
- Date: Sun, 21 May 2017 16:02:58 +0000 (UTC)
commit 988dacfb1bc2c47ecea01edc9203035f86c420aa
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Fri May 19 15:27:49 2017 +0100
Quote mount point when resizing nilfs2 (#782681)
The current nilfs2 resizing code is safe because it never passes a user
influenced mount point into a command line. Regardless, apply the same
simple rule to always quote mount points when used in command lines.
WARNING:
Nilfs-resize is broken and can't actually resize a file system mounted
with spaces in the mount point anyway!
# mkdir "/tmp/File System Label"
# mount -v -t nilfs2 /dev/sdb3 "/tmp/File System Label"
mount.nilfs2: started nilfs_cleanerd
# nilfs-resize -v -y /dev/sdb3
Error: cannot open NILFS on /dev/sdb3.
# echo $?
1
# strace nilfs-resize -v -y /dev/sdb3
...
stat("/dev/sdb3", {st_mode=S_IFBLK|0660, st_rdev=makedev(8, 19), ...}) = 0
open("/dev/sdb3", O_RDONLY) = 3
...
open("/proc/mounts", O_RDONLY) = 4
read(4, "sysfs /sys sysfs rw,seclabel,nos"..., 1024) = 1024
...
close(4) = 0
open("/tmp/File\\040System\\040Label", O_RDONLY) = -1 ENOENT (No such file or directory)
...
# fgrep /dev/sd /proc/mounts
/dev/sda3 / ext4 rw,seclabel,relatime,data=ordered 0 0
/dev/sda1 /boot ext4 rw,seclabel,relatime,data=ordered 0 0
/dev/sdb3 /tmp/File\040System\040Label nilfs2 rw,relatime 0 0
So it looks like nilfs-resize (or a library it uses) can't decode the
octal characters '\040' used to encode spaces in the mount point as
reported in /proc/mounts.
Bug 782681 - btrfs partitions mounted with whitespace cannot be resized
src/nilfs2.cc | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/nilfs2.cc b/src/nilfs2.cc
index e628e73..fe7cfe9 100644
--- a/src/nilfs2.cc
+++ b/src/nilfs2.cc
@@ -180,7 +180,8 @@ bool nilfs2::resize( const Partition & partition_new, OperationDetail & operatio
if ( mount_point .empty() )
return false ;
- success &= ! execute_command( "mount -v -t nilfs2 " + partition_new .get_path() + " " +
mount_point,
+ success &= ! execute_command( "mount -v -t nilfs2 " + partition_new .get_path() +
+ " \"" + mount_point + "\"",
operationdetail, EXEC_CHECK_STATUS );
}
@@ -196,7 +197,8 @@ bool nilfs2::resize( const Partition & partition_new, OperationDetail & operatio
success &= ! execute_command( cmd, operationdetail, EXEC_CHECK_STATUS );
if ( ! partition_new. busy )
- success &= ! execute_command( "umount -v " + mount_point, operationdetail,
EXEC_CHECK_STATUS );
+ success &= ! execute_command( "umount -v \"" + mount_point + "\"",
+ operationdetail, EXEC_CHECK_STATUS );
}
if ( ! partition_new .busy )
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]