Skip to contentSkip to conversation

e2fsprogs: Escape filenames in populate-extfs.sh

PATCH In review Søren Holm 2 participants 6 messages Oct 28, 2013 – Nov 1, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 e2fsprogs: Escape filenames in populate-extfs.sh

[YOCTO #5401]

---
 .../e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh     | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh +10 -10
index 9eff030..7de720b 100644
@@ -35,7 +35,7 @@ DEBUGFS="debugfs"
 		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
@@ -43,20 +43,20 @@ DEBUGFS="debugfs"
 			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
@@ -64,11 +64,11 @@ DEBUGFS="debugfs"
 		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.
Signature · 1 line
1.8.3.2
#1 lore raw

Hi

I'm reposting my patch as a response tot this message. I forgot adding some actual description of why the change is necessary. Sorry.

I would like the change to go into dora if possible.

Signature · 1 line
Søren Holm
#2 lore raw

PATCH 1/1 e2fsprogs: Escape filenames in populate-extfs.sh

Without this patch filenames containing spaces do not get into the final ext2/3/4 filsystem.

[YOCTO #5401]

---
 .../e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh     | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh +10 -10
index 9eff030..7de720b 100644
@@ -35,7 +35,7 @@ DEBUGFS="debugfs"
 		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
@@ -43,20 +43,20 @@ DEBUGFS="debugfs"
 			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
@@ -64,11 +64,11 @@ DEBUGFS="debugfs"
 		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.
Signature · 1 line
1.8.3.2
#3 lore raw
In reply to Søren Holm

Please sent patches to oe-core@.

Ross

Quoted 67 lines · Søren Holm

[YOCTO #5401]

---
 .../e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh     | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh +10 -11
index 9eff030..7de720b 100644
@@ -35,7 +35,7 @@ DEBUGFS="debugfs"
                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
@@ -43,20 +43,20 @@ DEBUGFS="debugfs"
                        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
@@ -64,11 +64,11 @@ DEBUGFS="debugfs"
                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.8.3.2

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#4 lore raw

Fredag den 1. november 2013 11:11:52 skrev Burton, Ross:

Quoted 2 lines

Please sent patches to oe-core@.

Should patches be sent to oe-core only or should they also be sent to yocto?

Signature · 1 line
Søren Holm
#5 lore raw

[email protected] only. yocto@ is for community announcements and user support.

Ross

Quoted 8 lines · Søren Holm

Fredag den 1. november 2013 11:11:52 skrev Burton, Ross:

Quoted 2 lines

Please sent patches to oe-core@.

Should patches be sent to oe-core only or should they also be sent to yocto?

--
Søren Holm