On Sun, 2013-05-26 at 11:14 +0200, Stefano Lattarini wrote:
> Actually no; maybe it is *possible* to play some tricks with the
> inherited file descriptors in order to mitigate or fix the issue,
> but I haven't given it any real thought.

Well, we can use fcntl() to set O_APPEND on stdout/stderr.  But I'm not
sure that's always the right thing to do.  It would work in the common
cases ("make >foo") because by the time make is invoked, the destination
file has already been truncated by the open() the shell performed.

Is there a situation where this would do the WRONG (unexpected) thing?
I guess someone could invoke make with a stdout opened without O_APPEND,
but also without O_TRUNC.  Then if we changed to O_APPEND, we'd get
different behavior.  It's very hard to think of a valid use-case for
opening a file used for stdout in this mode, however.  Maybe it's
bizarre enough to not worry about.

Might be worthwhile checking the FreeBSD code for their make, to see if
they do something like this.


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to