Hi Eric, (Another!) Nice catch :-)
Even in the absence of any fixes, making these sorts of issues into tests as we find them serves both to document known shortcomings and to prevent
future regressions when the problems have been fixed -- an excellent way
to make the source code robust...
Cheers,
Gary.
On 18 Aug 2006, at 20:58, Eric Blake wrote:
Eric Blake <ebb9 <at> byu.net> writes:I'm still thinking about how best to patch this. I know gnulib provides the stdio-safer module (and friends) that guarantee that stdio functions likefopendon't reuse fd's 0, 1, or 2 (and hence that stdin, stdout, and stderr remain closed if they started life closed). I also know that gnulib provides the closeout module, which we should probably be using (and issue an error if anyoutput was attempted to stdout when it was already closed).Even with my earlier patches, I'm still finding issues. For example: $ m4 | cat -s divert(-1) define(`f',` ') define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) define(`f',defn(`f')defn(`f')) divert(1) f divert syscmd(echo hi >&3) hi $Oops - we didn't set the fd of our temporary file to close-on-exec, so thechild process inherited it and was able to pollute it. -- Eric Blake _______________________________________________ Bug-m4 mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-m4
--Gary V. Vaughan ())_. gary@ {lilith.warpmail.net,gnu.org},[EMAIL PROTECTED]
Research Scientist ( '/ http://blog.azazil.net GNU Hacker / )= http://www.gnu.org/software/{libtool,m4} Technical Author `(_~)_ http://sources.redhat.com/autobook
PGP.sig
Description: This is a digitally signed message part
_______________________________________________ Bug-m4 mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-m4
