]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
scripts/sanitizer-env.sh: check and warn if OUR_PRELOAD is not a file
authorEmil Velikov <emil.l.velikov@gmail.com>
Fri, 1 Nov 2024 13:37:47 +0000 (13:37 +0000)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 7 Nov 2024 17:07:41 +0000 (11:07 -0600)
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 <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/219
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
scripts/sanitizer-env.sh

index dcb80774a34474ec22ee0930c0424c1cc6717ec0..f5a42cf450906d88f916f42f266e76ea20b980cb 100755 (executable)
@@ -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