All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/bootconfig: fix single & used for logical condition
@ 2023-01-12 11:42 Antonio Alvarez Feijoo
  2023-01-19 22:49 ` Masami Hiramatsu
  0 siblings, 1 reply; 2+ messages in thread
From: Antonio Alvarez Feijoo @ 2023-01-12 11:42 UTC (permalink / raw
  To: Masami Hiramatsu, linux-kernel; +Cc: 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.

Signed-off-by: Antonio Alvarez Feijoo <antonio.feijoo@suse.com>
---
 tools/bootconfig/scripts/ftrace2bconf.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bootconfig/scripts/ftrace2bconf.sh b/tools/bootconfig/scripts/ftrace2bconf.sh
index 6183b36c6846..1603801cf126 100755
--- a/tools/bootconfig/scripts/ftrace2bconf.sh
+++ b/tools/bootconfig/scripts/ftrace2bconf.sh
@@ -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
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tools/bootconfig: fix single & used for logical condition
  2023-01-12 11:42 [PATCH] tools/bootconfig: fix single & used for logical condition Antonio Alvarez Feijoo
@ 2023-01-19 22:49 ` Masami Hiramatsu
  0 siblings, 0 replies; 2+ messages in thread
From: Masami Hiramatsu @ 2023-01-19 22:49 UTC (permalink / raw
  To: Antonio Alvarez Feijoo; +Cc: linux-kernel

On Thu, 12 Jan 2023 12:42:15 +0100
Antonio Alvarez Feijoo <antonio.feijoo@suse.com> wrote:

> 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!

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Thank you!

> Signed-off-by: Antonio Alvarez Feijoo <antonio.feijoo@suse.com>
> ---
>  tools/bootconfig/scripts/ftrace2bconf.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/bootconfig/scripts/ftrace2bconf.sh b/tools/bootconfig/scripts/ftrace2bconf.sh
> index 6183b36c6846..1603801cf126 100755
> --- a/tools/bootconfig/scripts/ftrace2bconf.sh
> +++ b/tools/bootconfig/scripts/ftrace2bconf.sh
> @@ -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
> -- 
> 2.35.3
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-20  5:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-12 11:42 [PATCH] tools/bootconfig: fix single & used for logical condition Antonio Alvarez Feijoo
2023-01-19 22:49 ` Masami Hiramatsu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.