diff run-octave.in @ 30277:f816a8c44924

allow build to succeed when address sanitizer is enabled (bug #61415) * configure.ac, Makefile.am: Explicitly substitute ADDRESS_SANITIZER_ENABLED and ADDRESS_SANITIZER_OPTIONS. * subst-script-vals.in.sh: Also substitute ADDRESS_SANITIZER_ENABLED. * run-octave.in: New option, -disable-asan, to suppress address sanitizer output and disable leak checks on exit. * graphics_properties.mk, images.awk, doc/interpreter/module.mk: Invoke run-octave with -disable-asan.
author John W. Eaton <jwe@octave.org>
date Wed, 10 Nov 2021 11:50:31 -0500
parents 2a4980872234
children 796f54d4ddbf
line wrap: on
line diff
--- a/run-octave.in	Wed Nov 10 10:38:12 2021 -0500
+++ b/run-octave.in	Wed Nov 10 11:50:31 2021 -0500
@@ -30,7 +30,8 @@
 : ${AWK=%AWK%}
 : ${FIND=%FIND%}
 : ${SED=%SED%}
-: ${ADDRESS_SANITIZER_OPTIONS="%ADRESS_SANITIZER_OPTIONS%"}
+: ${ADDRESS_SANITIZER_ENABLED="%ADDRESS_SANITIZER_ENABLED%"}
+: ${ADDRESS_SANITIZER_OPTIONS="%ADDRESS_SANITIZER_OPTIONS%"}
 
 # FIXME: is there a better way to handle the possibility of spaces
 #        in these names?
@@ -90,6 +91,9 @@
   elif [ "x$1" = "x-cli" ]; then
     octave_executable="$builddir/src/octave-cli"
     shift
+  elif [ "x$1" = "x-disable-asan" ]; then
+    disable_asan=yes
+    shift
   else
     break
   fi
@@ -119,7 +123,15 @@
 OCTAVE_VERSION_INITFILE="$top_srcdir/scripts/startup/version-rcfile"; export OCTAVE_VERSION_INITFILE
 
 if [ "$ADDRESS_SANITIZER_ENABLED" = yes ]; then
-  ASAN_OPTIONS=symbolize=1; export ASAN_OPTIONS
+  if [ "$disable_asan" = yes ]; then
+    ## Is there a better way to do this so that we don't fill /tmp
+    ## with junk files?  Using /dev/null won't work because asan
+    ## appends the process ID to the file name.
+    ASAN_OPTIONS="leak_check_at_exit=0:log_path=/tmp/oct-asan-log:verbosity=0"
+  else
+    ASAN_OPTIONS="$ADDRESS_SANITIZER_OPTIONS"
+  fi
+  export ASAN_OPTIONS
 fi
 
 exec $builddir/libtool --mode=execute $driver \