Re: Make run in parallel mode with output redirected to a regular file can randomly drop output lines

2013-05-31 Thread Eli Zaretskii
Date: Fri, 31 May 2013 05:36:24 +0200 Cc: psm...@gnu.org, stefano.lattar...@gmail.com, bug-make@gnu.org From: Frank Heckenbach f.heckenb...@fh-soft.de Eli Zaretskii wrote: From: Frank Heckenbach f.heckenb...@fh-soft.de However, there may still be a problem. The trick about

Re: Make run in parallel mode with output redirected to a regular file can randomly drop output lines

2013-05-31 Thread Frank Heckenbach
Eli Zaretskii wrote: From: Frank Heckenbach f.heckenb...@fh-soft.de Eli Zaretskii wrote: The problem exists, but there's nothing that can be done about it, as long as we use write/fwrite/fprintf for this: the call to 'write' isn't atomic on Windows even without O_APPEND,

Re: Make run in parallel mode with output redirected to a regular file can randomly drop output lines

2013-05-31 Thread Eli Zaretskii
Date: Fri, 31 May 2013 16:58:21 +0200 Cc: psm...@gnu.org, stefano.lattar...@gmail.com, bug-make@gnu.org From: Frank Heckenbach f.heckenb...@fh-soft.de void write (int fd, void *data, size_t size) { if (getflags (fd) O_APPEND) { lock_mutex (get_mutex (fd));

Re: Make run in parallel mode with output redirected to a regular file can randomly drop output lines

2013-05-31 Thread Frank Heckenbach
Eli Zaretskii wrote: From: Frank Heckenbach f.heckenb...@fh-soft.de void write (int fd, void *data, size_t size) { if (getflags (fd) O_APPEND) { lock_mutex (get_mutex (fd)); off_t pos = get_size (fd); do_write (fd, pos, data, size);

Re: Make run in parallel mode with output redirected to a regular file can randomly drop output lines

2013-05-29 Thread Frank Heckenbach
Eli Zaretskii wrote: Date: Mon, 27 May 2013 00:42:34 +0200 From: Frank Heckenbach f.heckenb...@fh-soft.de Cc: bug-make@gnu.org One issue, though it might seem strange that I'm the one to mention it, is that it might be POSIX specific. How do other systems behave, can they set

Re: Make run in parallel mode with output redirected to a regular file can randomly drop output lines

2013-05-29 Thread Frank Heckenbach
Martin Dorey wrote: Frank wrote: the two-step procedure (remove and ). Woah, *truncate* and . Removal wouldn't do the right thing for symlinks. You're right, of course, thanks! That said, I'm now going back to my own programs which redirect stdout in forked child processes and add

Re: Make run in parallel mode with output redirected to a regular file can randomly drop output lines

2013-05-29 Thread Frank Heckenbach
Eli Zaretskii wrote: If Windows has a function to make a copy of a FD, whatever it is, with new flags, this plus dup2 would be mostly equivalent to fcntl for our purposes indeed. On Windows, file descriptors are created and maintained by the C runtime, and they are private to the

Re: Make run in parallel mode with output redirected to a regular file can randomly drop output lines

2013-05-27 Thread Eli Zaretskii
Date: Mon, 27 May 2013 00:42:34 +0200 From: Frank Heckenbach f.heckenb...@fh-soft.de Cc: bug-make@gnu.org One issue, though it might seem strange that I'm the one to mention it, is that it might be POSIX specific. How do other systems behave, can they set O_APPEND via fcntl or otherwise

Re: Make run in parallel mode with output redirected to a regular file can randomly drop output lines

2013-05-27 Thread Paul Smith
On Mon, 2013-05-27 at 20:13 +0300, Eli Zaretskii wrote: and if so, does it guarantee non-conflicting writes? Not sure I understand what you are asking here. Can you elaborate? The original issue reported is that if you do something like this: make -j make.out and your make environment

Re: Make run in parallel mode with output redirected to a regular file can randomly drop output lines

2013-05-26 Thread Paul Smith
On Sun, 2013-05-26 at 22:05 +0200, Stefano Lattarini wrote: On 05/26/2013 09:57 PM, Paul Smith wrote: [SNIP] Might be worthwhile checking the FreeBSD code for their make, to see if they do something like this. Nope, Frank was right: when run in parallel mode, FreeBSD make

Re: Make run in parallel mode with output redirected to a regular file can randomly drop output lines

2013-05-26 Thread Stefano Lattarini
On 05/26/2013 10:20 PM, Paul Smith wrote: On Sun, 2013-05-26 at 22:05 +0200, Stefano Lattarini wrote: On 05/26/2013 09:57 PM, Paul Smith wrote: [SNIP] Might be worthwhile checking the FreeBSD code for their make, to see if they do something like this. Nope, Frank was right: when run in

Re: Make run in parallel mode with output redirected to a regular file can randomly drop output lines

2013-05-26 Thread Frank Heckenbach
Paul Smith wrote: Nevertheless, I do wonder whether forcing stdout/stderr into O_APPEND mode would be worthwhile. It would fix this problem in any event. I'm having a hard time coming up with a reason NOT to do it. One issue, though it might seem strange that I'm the one to mention it, is