public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: David Laight <David.Laight@aculab.com>
Cc: 'Guillaume Tucker' <guillaume.tucker@collabora.com>,
	Shuah Khan <shuah@kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] selftests/lkdtm: Use /bin/sh not $SHELL
Date: Wed, 23 Jun 2021 09:18:44 -0700	[thread overview]
Message-ID: <202106230917.FE2F587@keescook> (raw)
In-Reply-To: <42f26361db6f481e980ac349bf0079ef@AcuMS.aculab.com>

On Wed, Jun 23, 2021 at 01:43:04PM +0000, David Laight wrote:
> From: Guillaume Tucker
> > Sent: 23 June 2021 13:40
> ...
> > > diff --git a/tools/testing/selftests/lkdtm/run.sh b/tools/testing/selftests/lkdtm/run.sh
> > > index bb7a1775307b..0f9f22ac004b 100755
> > > --- a/tools/testing/selftests/lkdtm/run.sh
> > > +++ b/tools/testing/selftests/lkdtm/run.sh
> > > @@ -78,8 +78,9 @@ dmesg > "$DMESG"
> > >
> > >  # Most shells yell about signals and we're expecting the "cat" process
> > >  # to usually be killed by the kernel. So we have to run it in a sub-shell
> > > -# and silence errors.
> > > -($SHELL -c 'cat <(echo '"$test"') >'"$TRIGGER" 2>/dev/null) || true
> > > +# to avoid terminating this script. Leave stderr alone, just in case
> > > +# something _else_ happens.
> > > +(/bin/sh -c '(echo '"$test"') | cat >'"$TRIGGER") || true
> 
> I was having trouble parsing that command - and I'm good
> at shell scripts.
> I think the extra subshell the 'echo' is in doesn't help.
> In fact, is either subshell needed?
> Surely:
> /bin/sh -c "echo '$test' | cat >$trigger" || true
> will work just as well?

Ah yeah, and I just tested it to double check, it can be even simpler:

echo "$test" | /bin/sh -c "cat >$TRIGGER" || true

I'll adjust and resend...

-Kees

-- 
Kees Cook

  reply	other threads:[~2021-06-23 16:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-19  2:58 [PATCH v2] selftests/lkdtm: Use /bin/sh not $SHELL Kees Cook
2021-06-23 12:39 ` Guillaume Tucker
2021-06-23 13:43   ` David Laight
2021-06-23 16:18     ` Kees Cook [this message]
2021-06-23 16:27       ` David Laight
2021-06-23 22:46         ` Kees Cook
2021-06-24  7:21           ` David Laight
2021-06-23 14:38   ` Kees Cook
2021-06-23 15:19     ` Guillaume Tucker
2021-06-23 14:35 ` [selftests/lkdtm] 84d8cf25b0: kernel_BUG_at_drivers/misc/lkdtm/bugs.c kernel test robot
2021-06-23 14:30   ` Kees Cook

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=202106230917.FE2F587@keescook \
    --to=keescook@chromium.org \
    --cc=David.Laight@aculab.com \
    --cc=guillaume.tucker@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox