Re: [PATCH v3] perf build: Specify that shellcheck should use the bash dialect.
From: Collin Funk
Date: Fri Jun 27 2025 - 23:35:18 EST
Hi Namhyung,
Namhyung Kim <namhyung@xxxxxxxxxx> writes:
> This caused a trouble on a test environment where 'which' (and
> 'shellcheck' as well) is not available. Now it makes SHELLCHECK
> non-empty unconditionally.
>
> So the version check below failed like below:
>
> make[1]: which: No such file or directory
> /bin/sh: - : invalid option
> Usage: /bin/sh [GNU long option] [option] ...
> /bin/sh [GNU long option] [option] script-file ...
> GNU long options:
> --debug
> --debugger
> --dump-po-strings
> --dump-strings
> --help
> --init-file
> --login
> --noediting
> --noprofile
> --norc
> --posix
> --pretty-print
> --rcfile
> --rpm-requires
> --restricted
> --verbose
> --version
> Shell options:
> -ilrsD or -c command or -O shopt_option (invocation only)
> -abefhkmnptuvxBCEHPT or -o option
> expr: syntax error: unexpected argument ‘060’
>
> And it failed to build later on shellchecks.
>
> TEST /build/arch/x86/tests/gen-insn-x86-dat.sh.shellcheck_log
> /bin/sh: line 1: -s: command not found
> make[6]: *** [arch/x86/tests/Build:25: /build/arch/x86/tests/gen-insn-x86-dat.sh.shellcheck_log] Error 1
> make[6]: *** Waiting for unfinished jobs....
>
> I think it's better to convert 'which' to 'command -v' (in other places
> too) and add the options after the version check.
Oops, I assumed that on a system without shellcheck NO_SHELLCHECK would
be defined. Let me write another version.
I think the 'command -v' change is best left for a separate patch(s).
Since it is used in many other places, and maybe others will raise
objections.
Collin