# Re: \[PATCH\] tracing/selftests: Fix false bashism in kprobe\_non\_uniq\_symbol.tc

- From: Masami Hiramatsu (Google) \<mhiramat@kernel.org\>
- Date: 2026-11-03 00:19:18 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2026/11/17848570
- Thread: https://ratatoskr.run/linux-trace-kernel/2026/10/17830153/t.md

```text
On Thu, 29 Oct 2026 21:12:18 -0400, Steven Rostedt [ref] 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: <redacted>
> 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) [ref]
```
