Skip to contentSkip to conversation

devtools: fix checkpatch for filename with space

PATCH In review Thomas Monjalon 2 participants 3 messages Jul 20, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtools: fix checkpatch for filename with space

If the patch filename or the temporary file path have a space in their name, the script checkpatches.sh does not work. The variables for the filenames must be enclosed in quotes in order to preserve spaces.

Fixes 4bec48184e33 ("devtools: add checks for ABI symbol addition")

---

Strangely, I did a fix for check-symbol-change.sh and I forgot to fix checkpatches.sh.

---
 devtools/checkpatches.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
devtools/checkpatches.sh +4 -4
index 1439bce94..e97a4f2c9 100755
@@ -25,7 +25,7 @@ NEW_TYPEDEFS,COMPARISON_TO_NULL"
 
 clean_tmp_files() {
 	if echo $tmpinput | grep -q '^checkpatches\.' ; then
-		rm -f $tmpinput
+		rm -f "$tmpinput"
 	fi
 }
 
@@ -77,13 +77,13 @@ check () { # <patch> <commit> <title>
 	elif [ -n "$2" ] ; then
 		tmpinput=$(mktemp checkpatches.XXXXXX)
 		git format-patch --find-renames \
-		--no-stat --stdout -1 $commit > $tmpinput
+		--no-stat --stdout -1 $commit > "$tmpinput"
 	else
 		tmpinput=$(mktemp checkpatches.XXXXXX)
-		cat > $tmpinput
+		cat > "$tmpinput"
 	fi
 
-	report=$($DPDK_CHECKPATCH_PATH $options $tmpinput 2>/dev/null)
+	report=$($DPDK_CHECKPATCH_PATH $options "$tmpinput" 2>/dev/null)
 	if [ $? -ne 0 ] ; then
 		$verbose || printf '\n### %s\n\n' "$3"
 		printf '%s\n' "$report" | sed -n '1,/^total:.*lines checked$/p'
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Thomas Monjalon

If the patch filename or the temporary file path have a space in their name, the script checkpatches.sh does not work. The variables for the filenames must be enclosed in quotes in order to preserve spaces.

Fixes 4bec48184e33 ("devtools: add checks for ABI symbol addition")
Quoted 43 lines

---

Strangely, I did a fix for check-symbol-change.sh and I forgot to fix checkpatches.sh.

---
 devtools/checkpatches.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
devtools/checkpatches.sh +4 -4
index 1439bce94..e97a4f2c9 100755
@@ -25,7 +25,7 @@ NEW_TYPEDEFS,COMPARISON_TO_NULL"
 
 clean_tmp_files() {
 	if echo $tmpinput | grep -q '^checkpatches\.' ; then
-		rm -f $tmpinput
+		rm -f "$tmpinput"
 	fi
 }
 
@@ -77,13 +77,13 @@ check () { # <patch> <commit> <title>
 	elif [ -n "$2" ] ; then
 		tmpinput=$(mktemp checkpatches.XXXXXX)
 		git format-patch --find-renames \
-		--no-stat --stdout -1 $commit > $tmpinput
+		--no-stat --stdout -1 $commit > "$tmpinput"
 	else
 		tmpinput=$(mktemp checkpatches.XXXXXX)
-		cat > $tmpinput
+		cat > "$tmpinput"
 	fi
 
-	report=$($DPDK_CHECKPATCH_PATH $options $tmpinput 2>/dev/null)
+	report=$($DPDK_CHECKPATCH_PATH $options "$tmpinput" 2>/dev/null)
 	if [ $? -ne 0 ] ; then
 		$verbose || printf '\n### %s\n\n' "$3"
 		printf '%s\n' "$report" | sed -n '1,/^total:.*lines checked$/p'
Signature · 1 line
2.17.1
author Applied
#2 lore raw

20/07/2018 20:25, Neil Horman:

Quoted 6 lines · Thomas Monjalon
Quoted 5 lines

If the patch filename or the temporary file path have a space in their name, the script checkpatches.sh does not work. The variables for the filenames must be enclosed in quotes in order to preserve spaces.

Quoted 11 lines
Quoted 3 lines
Fixes 4bec48184e33 ("devtools: add checks for ABI symbol addition")
Quoted 6 lines

---

Strangely, I did a fix for check-symbol-change.sh and I forgot to fix checkpatches.sh.

---

Applied