mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tracing/selftests: Fix false bashism in kprobe_non_uniq_symbol.tc
@ 2026-10-30  1:12 Steven Rostedt
  2026-11-03  0:19 ` Masami Hiramatsu (Google)
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2026-10-30  1:12 UTC (permalink / raw)
  To: LKML, Linux trace kernel, linux-kselftest
  Cc: Masami Hiramatsu, Mathieu Desnoyers, Sven Schnelle, Shuah Khan

From: Steven Rostedt <rostedt@goodmis.org>

The checkbashism is giving a false positive to the kprobe test of:

  ($"foo" should be eval_gettext "foo"):
  if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}$" /proc/kallsyms)" -le '1' ]; then

This is because it sees the $" at the end of the grep as a bash symbol.
Instead, escape the '$' with a backslash as it is within quotes and that
'$' is for grep to process an end of line character and not a bash
variable.

Cc: stable@vger.kernel.org
Fixes: d22c3e0088e85 ("selftests/ftrace: Fix unique symbol check in kprobe_non_uniq_symbol.tc")
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 .../selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
index 03eb9e70b438..f8e18ea8c268 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
@@ -6,7 +6,7 @@
 SYMBOL='init_once'
 
 # We skip this test on kernel where SYMBOL is unique or does not exist.
-if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}$" /proc/kallsyms)" -le '1' ]; then
+if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}\$" /proc/kallsyms)" -le '1' ]; then
 	exit_unsupported
 fi
 
-- 
2.53.0


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

* Re: [PATCH] tracing/selftests: Fix false bashism in kprobe_non_uniq_symbol.tc
  2026-10-30  1:12 [PATCH] tracing/selftests: Fix false bashism in kprobe_non_uniq_symbol.tc Steven Rostedt
@ 2026-11-03  0:19 ` Masami Hiramatsu (Google)
  2026-11-05 21:22   ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Masami Hiramatsu (Google) @ 2026-11-03  0:19 UTC (permalink / raw)
  To: Steven Rostedt, Shuah Khan
  Cc: LKML, Linux trace kernel, linux-kselftest, Mathieu Desnoyers,
	Sven Schnelle, Shuah Khan

On Thu, 29 Oct 2026 21:12:18 -0400, Steven Rostedt <rostedt@goodmis.org> wrote:
> From: Steven Rostedt <rostedt@goodmis.org>
>
> The checkbashism is giving a false positive to the kprobe test of:
>
>   ($"foo" should be eval_gettext "foo"):
>   if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}$" /proc/kallsyms)" -le '1' ]; then
>
> This is because it sees the $" at the end of the grep as a bash symbol.
> Instead, escape the '$' with a backslash as it is within quotes and that
> '$' is for grep to process an end of line character and not a bash
> variable.
>
> Cc: stable@vger.kernel.org
> Fixes: d22c3e0088e85 ("selftests/ftrace: Fix unique symbol check in kprobe_non_uniq_symbol.tc")
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Oops, good catch!

Looks good to me.

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

Shuah, can you pick this?

Thanks,

> ---
>  .../selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc    | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
> index 03eb9e70b438..f8e18ea8c268 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
> @@ -6,7 +6,7 @@
>  SYMBOL='init_once'
>  
>  # We skip this test on kernel where SYMBOL is unique or does not exist.
> -if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}$" /proc/kallsyms)" -le '1' ]; then
> +if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}\$" /proc/kallsyms)" -le '1' ]; then
>  	exit_unsupported
>  fi
>  
>

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

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

* Re: [PATCH] tracing/selftests: Fix false bashism in kprobe_non_uniq_symbol.tc
  2026-11-03  0:19 ` Masami Hiramatsu (Google)
@ 2026-11-05 21:22   ` Shuah Khan
  0 siblings, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2026-11-05 21:22 UTC (permalink / raw)
  To: Masami Hiramatsu (Google), Steven Rostedt, Shuah Khan
  Cc: LKML, Linux trace kernel, linux-kselftest, Mathieu Desnoyers,
	Sven Schnelle, Shuah Khan

On 11/2/26 17:19, Masami Hiramatsu (Google) wrote:
> On Thu, 29 Oct 2026 21:12:18 -0400, Steven Rostedt <rostedt@goodmis.org> wrote:
>> From: Steven Rostedt <rostedt@goodmis.org>
>>
>> The checkbashism is giving a false positive to the kprobe test of:
>>
>>    ($"foo" should be eval_gettext "foo"):
>>    if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}$" /proc/kallsyms)" -le '1' ]; then
>>
>> This is because it sees the $" at the end of the grep as a bash symbol.
>> Instead, escape the '$' with a backslash as it is within quotes and that
>> '$' is for grep to process an end of line character and not a bash
>> variable.
>>
>> Cc: stable@vger.kernel.org
>> Fixes: d22c3e0088e85 ("selftests/ftrace: Fix unique symbol check in kprobe_non_uniq_symbol.tc")
>> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> 
> Oops, good catch!
> 
> Looks good to me.
> 
> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 
> Shuah, can you pick this?
> 

Applied to kselftest fixes branch for next rc

thanks,
-- Shuah

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

end of thread, other threads:[~2026-11-05 21:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-30  1:12 [PATCH] tracing/selftests: Fix false bashism in kprobe_non_uniq_symbol.tc Steven Rostedt
2026-11-03  0:19 ` Masami Hiramatsu (Google)
2026-11-05 21:22   ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®