Skip to contentSkip to conversation

tools/bootconfig: fix single & used for logical condition

PATCH In review Antonio Alvarez Feijoo 2 participants 2 messages Jan 12, 2023 – Jan 20, 2023 Extra boot config

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/bootconfig: fix single & used for logical condition

A single & will create a background process and return true, so the grep command will run even if the file checked in the first condition does not exist.

---
 tools/bootconfig/scripts/ftrace2bconf.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bootconfig/scripts/ftrace2bconf.sh +1 -1
index 6183b36c6846..1603801cf126 100755
@@ -93,7 +93,7 @@ referred_vars() {
 }
 
 event_is_enabled() { # enable-file
-	test -f $1 & grep -q "1" $1
+	test -f $1 && grep -q "1" $1
 }
 
 per_event_options() { # event-dir
Signature · 1 line
2.35.3
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · On Thu, 12 Jan 2023 12:42:15 +0100 Antonio Alvarez Feijoo…

A single & will create a background process and return true, so the grep command will run even if the file checked in the first condition does not exist.

Good catch!

Thank you!

Quoted 21 lines
---
 tools/bootconfig/scripts/ftrace2bconf.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bootconfig/scripts/ftrace2bconf.sh +1 -1
index 6183b36c6846..1603801cf126 100755
@@ -93,7 +93,7 @@ referred_vars() {
 }
 
 event_is_enabled() { # enable-file
-	test -f $1 & grep -q "1" $1
+	test -f $1 && grep -q "1" $1
 }
 
 per_event_options() { # event-dir
Signature · 1 line
2.35.3
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>