Re: [PATCH 2/2] selftests: livepatch: functions.sh: Workaround heredoc on older bash

From: Marcos Paulo de Souza

Date: Thu Feb 26 2026 - 09:45:09 EST


On Thu, 2026-02-26 at 13:40 +0100, Miroslav Benes wrote:
> Hi,
>
> On Mon, 23 Feb 2026, Marcos Paulo de Souza wrote:
>
> > On Mon, 2026-02-23 at 10:42 -0500, Joe Lawrence wrote:
> > > On Fri, Feb 20, 2026 at 11:12:34AM -0300, Marcos Paulo de Souza
> > > wrote:
> > > > When running current selftests on older distributions like
> > > > SLE12-
> > > > SP5 that
> > > > contains an older bash trips over heredoc. Convert it to plain
> > > > echo
> > > > calls, which ends up with the same result.
> > > >
> > >
> > > Acked-by: Joe Lawrence <joe.lawrence@xxxxxxxxxx>
> >
> > Thanks for the review Joe!
> >
> > >
> > > Just curious, what's the bash/heredoc issue?  All I could find
> > > via
> > > google search was perhaps something to do with the temporary file
> > > implementation under the hood.
> >
> > # ./test-ftrace.sh
> > cat: -: No such file or directory
> > TEST: livepatch interaction with ftrace_enabled sysctl ... ^CQEMU:
> > Terminated
>
> I cannot reproduce it locally on SLE12-SP5. The patched test-
> ftrace.sh
> runs smoothly without 2/2.
>
> linux:~/linux/tools/testing/selftests/livepatch # ./test-ftrace.sh
> TEST: livepatch interaction with ftrace_enabled sysctl ... ok
> TEST: trace livepatched function and check that the live patch
> remains in effect ... ok
> TEST: livepatch a traced function and check that the live patch
> remains in effect ... ok
>
> GNU bash, version 4.3.48(1)-release (x86_64-suse-linux-gnu)
>
> Does "set -x" in the script give you anything interesting?

Nope:

boot_livepatch:/mnt/tools/testing/selftests/livepatch # ./test-trace.sh
+ cat
cat: -: No such file or directory
+ set_ftrace_enabled 1
+ local can_fail=0


Same version here:
GNU bash, version 4.3.48(1)-release (x86_64-suse-linux-gnu)

I'm using virtme-ng, so I'm not sure if this is related. At the same
time it works on SLE15-SP4, using the same virtme-ng, but with a
different bash:
GNU bash, version 4.4.23(1)-release (x86_64-suse-linux-gnu)

So I was blaming bash for this issue...

>
> Miroslav