RE: [PATCH v2] selftests/lkdtm: Use /bin/sh not $SHELL
From: David Laight
Date: Thu Jun 24 2021 - 03:21:22 EST
From: Kees Cook
> Sent: 23 June 2021 23:47
>
> On Wed, Jun 23, 2021 at 04:27:47PM +0000, David Laight wrote:
...
> > You can probably even do:
> >
> > echo "$test" | /bin/sh -c cat >$TRIGGER || true
> >
> > (moving the redirect to the outer shell).
>
> Actually, it looks like the "write" is already happening in the exec'd
> process, so this can just be:
>
> echo "$test" | cat >$TRIGGER || true
>
> But it still can't be:
>
> echo "$test" >$TRIGGER
>
> which is what I had over-engineered a solution to. :)
That one fails because echo is the shell builtin.
But:
/bin/echo "$test" >$TRIGGER
should be fine.
Quite where the original came from I not sure I want to find out.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)