On Wed, Apr 20, 2011 at 9:58 PM, Philip Guenther <guent...@gmail.com> wrote: > Could you explain why you think that's spurious? Make wanted to write > "date" to stdout and the write failed. Seems legit to me.
That's actually not what generates the error message. I'm not sure why it doesn't happen the way you say, but it doesn't. Did you look at the patch? Here it is: Index: main.c =================================================================== RCS file: /sources/make/make/main.c,v retrieving revision 1.246 diff -u -r1.246 main.c --- main.c 29 Aug 2010 23:05:27 -0000 1.246 +++ main.c 21 Apr 2011 00:53:24 -0000 @@ -952,7 +959,8 @@ #endif #ifdef HAVE_ATEXIT - atexit (close_stdout); + if (ftell(stdout) != -1) + atexit (close_stdout); #endif /* Needed for OS/2 */ Basically in a (sensible and nicely documented) attempt to detect all errors, make does an explicit close of stdout just before exiting in order to make one last check for failure modes. However, it makes the mistake of assuming stdout was open to start with. So in fact what the child process did with stdout has nothing to do with this bug. It's as simple as closing an already-closed file descriptor and printing the resulting error, and my patch is as simple as "only close it if it's open". > (I'm not sure why it doesn't say "make: write error: Bad file > descriptor" like it does if you change the command invoked to ":", but > that's a distinct issue.) I noticed this and found it interesting as well. It gets even stranger too: looking at close_stdout() there are two possible messages: if (prev_fail || fclose_fail) { if (fclose_fail) error (NILF, _("write error: %s"), strerror (errno)); else error (NILF, _("write error")); exit (EXIT_FAILURE); } If you try the test case with -jN you get the first error but with -j alone you get the second one. David _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make