Re: [PATCH 2/2] selftests: livepatch: functions.sh: Workaround heredoc on older bash
From: Marcos Paulo de Souza
Date: Mon Feb 23 2026 - 11:25:10 EST
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
Somehow it doesn't understand the heredoc, but maybe I'm wrong...
either way, the change has the same outcome, so I believe that it
wasn't bad if we could change the cat for two echoes :)
Either way, if Petr or you think that this should be left as it is,
it's fine by me as well, I was just testing the change with an older
rootfs/kernels.
>
> --
> Joe
>
> > Signed-off-by: Marcos Paulo de Souza <mpdesouza@xxxxxxxx>
> > ---
> > tools/testing/selftests/livepatch/functions.sh | 6 ++----
> > 1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/tools/testing/selftests/livepatch/functions.sh
> > b/tools/testing/selftests/livepatch/functions.sh
> > index 8ec0cb64ad94..45ed04c6296e 100644
> > --- a/tools/testing/selftests/livepatch/functions.sh
> > +++ b/tools/testing/selftests/livepatch/functions.sh
> > @@ -96,10 +96,8 @@ function pop_config() {
> > }
> >
> > function set_dynamic_debug() {
> > - cat <<-EOF > "$SYSFS_DEBUG_DIR/dynamic_debug/control"
> > - file kernel/livepatch/* +p
> > - func klp_try_switch_task -p
> > - EOF
> > + echo "file kernel/livepatch/* +p" >
> > "$SYSFS_DEBUG_DIR/dynamic_debug/control"
> > + echo "func klp_try_switch_task -p" >
> > "$SYSFS_DEBUG_DIR/dynamic_debug/control"
> > }
> >
> > function set_ftrace_enabled() {
> >
> > --
> > 2.52.0
> >