bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why does close_stdout close stdout and stderr?


From: Paul Eggert
Subject: Re: Why does close_stdout close stdout and stderr?
Date: Sat, 25 May 2019 12:23:22 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

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

[Prev in Thread] Current Thread [Next in Thread]