summaryrefslogtreecommitdiff
path: root/scripts/livepatch
diff options
context:
space:
mode:
authorJoe Lawrence <joe.lawrence@redhat.com>2026-03-10 16:37:44 -0400
committerJosh Poimboeuf <jpoimboe@kernel.org>2026-03-16 12:46:48 -0700
commite4dbf70615e52255de3ff943ac08e0bbd080dcd6 (patch)
tree32a151dab98787fa098161861263e373308562c9 /scripts/livepatch
parentd36a7343f4bac518b6ef05e2ccc47acd3a2cdab9 (diff)
livepatch/klp-build: add grep-override function
Provide a custom grep() function to catch direct usage of the command. Bare grep calls are generally incompatible with pipefail and errexit behavior (where a failed match causes the script to exit). Developers can still call grep via command grep if that behavior is explicitly desired. Acked-by: Song Liu <song@kernel.org> Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260310203751.1479229-6-joe.lawrence@redhat.com Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Diffstat (limited to 'scripts/livepatch')
-rwxr-xr-xscripts/livepatch/klp-build7
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build
index 564985a1588a..cf6c2bf694aa 100755
--- a/scripts/livepatch/klp-build
+++ b/scripts/livepatch/klp-build
@@ -56,6 +56,13 @@ grep0() {
command grep "$@" || true
}
+# Because pipefail is enabled, the grep0 helper should be used instead of
+# grep, otherwise a failed match can propagate to an error.
+grep() {
+ echo "error: $SCRIPT: use grep0 or 'command grep' instead of bare grep" >&2
+ exit 1
+}
+
status() {
echo "$*"
}