Bruno Haible wrote:
For the other case, we can introduce, next to the !SANITIZE_ADDRESS test,
tests for
   getenv ("LD_PRELOAD") != NULL
   getenv ("ASAN_OPTIONS") != NULL
   getenv ("TSAN_OPTIONS") != NULL
   getenv ("MSAN_OPTIONS") != NULL
   getenv ("LSAN_OPTIONS") != NULL
We can add more such environment variables as needed. getenv() lookups
don't make system calls; so they are cheap.

A less-intrusive possibility is to suggest to people writing specialized log-to-stderr environments that they use an (optional) environment variable ERROR_FD to specify which file descriptor to log to (with the default being file descriptor 2), and that they test coreutils with ERROR_FD=3 and with file descriptor 3 open to their error log. That way, coreutils would not need to be modified, and could even get rid of the !SANITIZE_ADDRESS hack after AddressSanitizer adopts this approach.

Reply via email to