All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: James Clark <james.clark@linaro.org>
Cc: Collin Funk <collin.funk1@gmail.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	"Liang, Kan" <kan.liang@linux.intel.com>
Subject: Re: [PATCH] perf build: Specify that spellcheck should use the bash dialect.
Date: Fri, 20 Jun 2025 12:49:35 -0700	[thread overview]
Message-ID: <aFW7T9DH9WrjtgJ-@google.com> (raw)
In-Reply-To: <20cce2b1-eaad-4565-817b-b094aecee0a5@linaro.org>

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@gmail.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


  parent reply	other threads:[~2025-06-20 19:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-13  3:36 [PATCH] perf build: Specify that spellcheck should use the bash dialect Collin Funk
2025-06-19 10:28 ` James Clark
2025-06-20 17:40   ` Collin Funk
2025-06-23  8:10     ` James Clark
2025-06-23 16:37       ` Ian Rogers
2025-06-24  2:08         ` Collin Funk
2025-06-20 19:49   ` Namhyung Kim [this message]
2025-06-23  8:08     ` James Clark
2025-06-24  2:05 ` [PATCH v2] [PATCH] perf build: Specify that shellcheck " Collin Funk
2025-06-24  5:21   ` Ian Rogers
2025-06-24  5:51     ` Collin Funk
2025-06-24  5:44 ` [PATCH v3] " Collin Funk
2025-06-24  9:37   ` James Clark
2025-06-26 17:39   ` Namhyung Kim
2025-06-28  3:35     ` Collin Funk
2025-06-28  3:49       ` Collin Funk
2025-06-28  3:41   ` [PATCH v4] " Collin Funk
2025-07-01 17:55     ` Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aFW7T9DH9WrjtgJ-@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=collin.funk1@gmail.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.