From: Emil Velikov Date: Fri, 1 Nov 2024 13:37:47 +0000 (+0000) Subject: scripts/sanitizer-env.sh: check and warn if OUR_PRELOAD is not a file X-Git-Tag: v34~144 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=870aa6fe9921456c57daf4ee5cf17aece327b544;p=thirdparty%2Fkmod.git scripts/sanitizer-env.sh: check and warn if OUR_PRELOAD is not a file As seen with the upcoming clang 19 change, the library name has changed. Enhance the current test to check if the compiler provided string is a file and produce a warning with some handy tips when that's not the case. v2: - convert to heredoc - output to stderr Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/219 Signed-off-by: Lucas De Marchi --- diff --git a/scripts/sanitizer-env.sh b/scripts/sanitizer-env.sh index dcb80774..f5a42cf4 100755 --- a/scripts/sanitizer-env.sh +++ b/scripts/sanitizer-env.sh @@ -16,7 +16,7 @@ EOF OUR_PRELOAD=$(gcc -print-file-name=libasan.so) fi -if test -n "$OUR_PRELOAD"; then +if test -f "$OUR_PRELOAD"; then # In some cases, like in Fedora, the file is a script which cannot be # preloaded. Attempt to extract the details from within. if grep -q INPUT "$OUR_PRELOAD"; then @@ -31,6 +31,17 @@ if test -n "$OUR_PRELOAD"; then LD_PRELOAD has been set to "$LD_PRELOAD". The sanitizer might report issues with ANY process you execute. +EOF +else + cat <<- EOF >&2 + + WARNING: compiler returned non-existing library name "$OUR_PRELOAD". + + Make sure to install the relevant packages and ensure this script + references the correct library name. + + LD_PRELOAD will NOT be set. + EOF fi unset OUR_PRELOAD