From 07433e98c03075080ce4bd74e5aafc0efc070000 Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Wed, 27 Jul 2022 10:29:36 -0700 Subject: [PATCH] kpatch-cc: fix stripping of source tree prefix To support building out-of-tree kernel modules, the source tree prefix is attempted to be stripped from change object file paths to make them relative. However, if the path is already relative, the change can strip a substring instead, resulting in build errors. Ensure just the prefix is stripped instead of any substring. Fixes: #1282 Fixes: 51a8fad34ff3 ("Add support for building out-of-tree modules") --- kpatch-build/kpatch-cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kpatch-build/kpatch-cc b/kpatch-build/kpatch-cc index 5474a13..6f0063e 100755 --- a/kpatch-build/kpatch-cc +++ b/kpatch-build/kpatch-cc @@ -23,7 +23,7 @@ if [[ "$TOOLCHAINCMD" =~ ^(.*-)?gcc$ || "$TOOLCHAINCMD" =~ ^(.*-)?clang$ ]] ; th [[ "$obj" = */.tmp_mc_*.o ]] && break; [[ "$obj" = */.tmp_*.o ]] && obj="${obj/.tmp_/}" - relobj=${obj//$KPATCH_GCC_SRCDIR\//} + relobj=${obj##$KPATCH_GCC_SRCDIR/} case "$relobj" in *.mod.o|\ *built-in.o|\