Re: [bug #60774] make hangs on fcntl lock when using -O and stdout is /dev/null

2021-07-24 Thread Dmitry Goncharov via Bug reports and discussion for GNU make
Wanted to test that windows this still works with this change. So, i followed instructions in README.W32. Installed mingw gcc. Copied config.h.W32.template to config.h.w32. Ran build_W32.bat gcc. It fails with C:\dgoncharov\make>gcc -mthreads -Wall -std=gnu99 -gdwarf-2 -g3 -O2 -DMAKE_MAINT

[bug #60774] make hangs on fcntl lock when using -O and stdout is /dev/null

2021-07-24 Thread Dmitry Goncharov
Follow-up Comment #7, bug #60774 (project make): The windows code, which passes down the semaphore to children is reused to pass down the fd on unix. > The way you propose to reuse the Windows code brings that Windows-specific stuff back into view. it is not clear to me what windows specific

Re: [bug #60774] make hangs on fcntl lock when using -O and stdout is /dev/null

2021-07-24 Thread Dmitry Goncharov via Bug reports and discussion for GNU make
On Sat, Jul 24, 2021 at 3:02 PM David Boyce wrote: > The point is that only /dev/null *should* be shared. Any other file *might* > be locked by an unrelated process but that would represent an error condition > in which incorrect results should be expected. i think, it is less likely that an

Re: [bug #60774] make hangs on fcntl lock when using -O and stdout is /dev/null

2021-07-24 Thread David Boyce
> That would help this specific case indeed... The point is that only /dev/null *should* be shared. Any other file *might* be locked by an unrelated process but that would represent an error condition in which incorrect results should be expected. I can’t think of a file other than /dev/null

[bug #60774] make hangs on fcntl lock when using -O and stdout is /dev/null

2021-07-24 Thread Eli Zaretskii
Follow-up Comment #6, bug #60774 (project make): The idea of keeping the Windows code separate was to avoid cluttering common sources with Windows-specific stuff. The way you propose to reuse the Windows code brings that Windows-specific stuff back into view. But if Paul doesn't mind, neither

Re: [bug #60774] make hangs on fcntl lock when using -O and stdout is /dev/null

2021-07-24 Thread Dmitry Goncharov via Bug reports and discussion for GNU make
On Saturday, July 24, 2021, David Boyce wrote: > Wouldn’t a less intrusive solution be to check the inode/device of stdout > and if it’s the same as that of /dev/null just forego locking? That would help this specific case indeed. What about a case when make's stdout is redirected to another,

Re: [bug #60774] make hangs on fcntl lock when using -O and stdout is /dev/null

2021-07-24 Thread Dmitry Goncharov via Bug reports and discussion for GNU make
On Saturday, July 24, 2021, Eli Zaretskii wrote: > Follow-up Comment #5, bug #60774 (project make): > > The MS-Windows port of GNU Make doesn't lock stdout (or any other standard > device). Instead, it uses a mutex to synchronize output. So I think this > problem cannot happen on Windows.

Re: [bug #60774] make hangs on fcntl lock when using -O and stdout is /dev/null

2021-07-24 Thread David Boyce
Wouldn’t a less intrusive solution be to check the inode/device of stdout and if it’s the same as that of /dev/null just forego locking? > On Jul 24, 2021, at 11:26 AM, Eli Zaretskii wrote: > > Follow-up Comment #5, bug #60774 (project make): > > The MS-Windows port of GNU Make doesn't lock

[bug #60774] make hangs on fcntl lock when using -O and stdout is /dev/null

2021-07-24 Thread Eli Zaretskii
Follow-up Comment #5, bug #60774 (project make): The MS-Windows port of GNU Make doesn't lock stdout (or any other standard device). Instead, it uses a mutex to synchronize output. So I think this problem cannot happen on Windows. But I see that your changeset touches quite a few places in the

[bug #60774] make hangs on fcntl lock when using -O and stdout is /dev/null

2021-07-24 Thread Dmitry Goncharov
Follow-up Comment #4, bug #60774 (project make): In your case, Mike, you can either try this fix or find the offending process with lsof and kill it. ___ Reply to this item at:

[bug #60774] make hangs on fcntl lock when using -O and stdout is /dev/null

2021-07-24 Thread Dmitry Goncharov
Follow-up Comment #3, bug #60774 (project make): i pushed a fix here https://github.com/dgoncharov/make/tree/sv_60774_output_sync_deadlock. This fix does the following. Lock a temp file to synchronize output. 1. Lock a temp file, rather than stdout, to synchronize output. Locking stdout

[bug #60774] make hangs on fcntl lock when using -O and stdout is /dev/null

2021-07-24 Thread Dmitry Goncharov
Follow-up Comment #2, bug #60774 (project make): Thanks for your report, Mike. make uses file locking on stdout to synchronize output. int fd = fileno(STDOUT); fcntl (fd, F_SETLKW, ); After fcntl return make prints its output. In your case another process has /dev/null locked. With make's