lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aFW7T9DH9WrjtgJ-@google.com>
Date: Fri, 20 Jun 2025 12:49:35 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: James Clark <james.clark@...aro.org>
Cc: Collin Funk <collin.funk1@...il.com>, linux-perf-users@...r.kernel.org,
	linux-kernel@...r.kernel.org, Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
	Adrian Hunter <adrian.hunter@...el.com>,
	"Liang, Kan" <kan.liang@...ux.intel.com>
Subject: Re: [PATCH] perf build: Specify that spellcheck should use the bash
 dialect.

Hello,

On Thu, Jun 19, 2025 at 11:28:46AM +0100, James Clark wrote:
> 
> 
> On 13/06/2025 4:36 am, Collin Funk wrote:
> > When someone has a global shellcheckrc file, for example at
> > ~/.config/shellcheckrc, with the directive 'shell=sh', building perf
> > will fail with many shellcheck errors like:
> > 
> >      In tests/shell/base_probe/test_adding_kernel.sh line 294:
> >      (( TEST_RESULT += $? ))
> >      ^---------------------^ SC3006 (warning): In POSIX sh, standalone ((..)) is undefined.
> > 
> >      For more information:
> >        https://www.shellcheck.net/wiki/SC3006 -- In POSIX sh, standalone ((..)) is...
> >      make[5]: *** [tests/Build:91: tests/shell/base_probe/test_adding_kernel.sh.shellcheck_log] Error 1
> > 
> > Passing the '-s bash' option ensures that it runs correctly regardless
> > of a developers global configuration.
> > 
> > Signed-off-by: Collin Funk <collin.funk1@...il.com>
> > ---
> >   tools/perf/tests/Build | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/tests/Build b/tools/perf/tests/Build
> > index 2181f5a92148..26efc5d20f6c 100644
> > --- a/tools/perf/tests/Build
> > +++ b/tools/perf/tests/Build
> > @@ -89,7 +89,7 @@ endif
> >   $(OUTPUT)%.shellcheck_log: %
> >   	$(call rule_mkdir)
> > -	$(Q)$(call echo-cmd,test)shellcheck -a -S warning "$<" > $@ || (cat $@ && rm $@ && false)
> > +	$(Q)$(call echo-cmd,test)shellcheck -s bash -a -S warning "$<" > $@ || (cat $@ && rm $@ && false)
> >   perf-test-y += $(SHELL_TEST_LOGS)
> 
> If we're enforcing bash style with static analysis shouldn't we also change
> all the hashbangs to bash? Recently there have been changes to change sh to
> bash in some of the tests so presumably the hard rule for sh is no more?
> 
> In the past I've had to replace bashisms that didn't work in sh but it would
> be nice to have only one language to write tests in. I doubt anyone running
> the tests today is running somewhere without bash, or that changing it will
> break anything. If anything it will fix more bashisms that have already been
> written.
> 
> Just for reference there are 34 #!/bin/bash and 42 #!/bin/sh in
> tools/perf/tests

Thanks for raising the concern.  I agree that having one standard is a
way to go but I really don't have preference between those shells.

Thanks,
Namhyung


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ