Re: [PATCH v2 1/2] selftests: livepatch: add new ftrace helpers functions
From: Joe Lawrence
Date: Mon Mar 24 2025 - 14:37:00 EST
On Tue, Mar 18, 2025 at 06:20:35PM -0300, Filipe Xavier wrote:
> [ ... snip ... ]
>
> + if [[ -n "$FTRACE_FILTER" ]]; then
> + echo "$FTRACE_FILTER" \
> + | sed -e "/#### all functions enabled ####/d"
> + > "$SYSFS_TRACING_DIR/set_ftrace_filter"
> + fi
Also, this may be more stylistic than a functional nit (I don't know for
sure), but shellcheck [1] seemed confused about these lines:
In tools/testing/selftests/livepatch/functions.sh line 90:
> "$SYSFS_TRACING_DIR/set_ftrace_filter"
^-- SC2188 (warning): This redirection doesn't have a command. Move to its command (or use 'true' as no-op).
I wasn't going to comment on these until I saw shellcheck note them, but
I thought shell script convention was typically to end the line with the
redirection/pipe then escape the end of line like:
commands | commands > \
tee output.txt
There are a few existing examples of this pattern if you grep the
functions.sh file for '\\$'.
That said, I'm far from certain whether which order is better than the
other. The only reason for bringing it up is that shellcheck warns on
this patch's usage.
[1] https://www.shellcheck.net/
-- Joe