bug-make
[Top][All Lists]
Advanced

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

Re: Make run in parallel mode with output redirected to a regular file c


From: Paul Smith
Subject: Re: Make run in parallel mode with output redirected to a regular file can randomly drop output lines
Date: Sun, 26 May 2013 15:57:17 -0400

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.




reply via email to

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