[PATCH 2/2] populate-extfs.sh: espace the space in the filename

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Søren Holm <sgh@xxxxxx>

The filename which contains space would not get into the final
ext2/3/4 filsystem without this patch

Signed-off-by: Søren Holm <sgh@xxxxxx>
Signed-off-by: Robert Yang <liezhi.yang@xxxxxxxxxxxxx>
---
 contrib/populate-extfs.sh |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
 mode change 100755 => 100644 contrib/populate-extfs.sh

diff --git a/contrib/populate-extfs.sh b/contrib/populate-extfs.sh
old mode 100755
new mode 100644
index b1d3d1f..a84ec74
--- a/contrib/populate-extfs.sh
+++ b/contrib/populate-extfs.sh
@@ -44,7 +44,7 @@ fi
 		fi
 
 		# Only stat once since stat is a time consuming command
-		STAT=$(stat -c "TYPE=\"%F\";DEVNO=\"0x%t 0x%T\";MODE=\"%f\";U=\"%u\";G=\"%g\"" $FILE)
+		STAT=$(stat -c "TYPE=\"%F\";DEVNO=\"0x%t 0x%T\";MODE=\"%f\";U=\"%u\";G=\"%g\"" "$FILE")
 		eval $STAT
 
 		case $TYPE in
@@ -52,20 +52,20 @@ fi
 			echo "mkdir $TGT"
 			;;
 		"regular file" | "regular empty file")
-			echo "write $FILE $TGT"
+			echo "write \"$FILE\" \"$TGT\""
 			;;
 		"symbolic link")
-			LINK_TGT=$(readlink $FILE)
-			echo "symlink $TGT $LINK_TGT"
+			LINK_TGT=$(readlink "$FILE")
+			echo "symlink \"$TGT\" \"$LINK_TGT\""
 			;;
 		"block special file")
-			echo "mknod $TGT b $DEVNO"
+			echo "mknod \"$TGT\" b $DEVNO"
 			;;
 		"character special file")
-			echo "mknod $TGT c $DEVNO"
+			echo "mknod \"$TGT\" c $DEVNO"
 			;;
 		"fifo")
-			echo "mknod $TGT p"
+			echo "mknod \"$TGT\" p"
 			;;
 		*)
 			echo "Unknown/unhandled file type '$TYPE' file: $FILE" 1>&2
@@ -73,11 +73,11 @@ fi
 		esac
 
 		# Set the file mode
-		echo "sif $TGT mode 0x$MODE"
+		echo "sif \"$TGT\" mode 0x$MODE"
 
 		# Set uid and gid
-		echo "sif $TGT uid $U"
-		echo "sif $TGT gid $G"
+		echo "sif \"$TGT\" uid $U"
+		echo "sif \"$TGT\" gid $G"
 	done
 
 	# Handle the hard links.
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux