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

2022-08-30 Thread Paul D. Smith
Update of bug #60774 (project make): Status:None => Fixed Open/Closed:Open => Closed Component Version:None => 4.0 Fixed Release:

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

2021-07-26 Thread Paul Smith
On Sun, 2021-07-25 at 17:29 -0700, David Boyce wrote: > It's simple to detect this on a Unix-like host (see sample script > below) and my contention is that this is "plenty portable enough" Ah. Yes, determining if stdout is /dev/null can be done. I was definitely having an off day yesterday and

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

2021-07-25 Thread David Boyce
Paul, I don't understand why you say "I don't know of any portable way of determining whether stdout is going to /dev/null, or not" and "However, it's moot because I don't think we can detect it". It's simple to detect this on a Unix-like host (see sample script below) and my contention is that

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

2021-07-25 Thread Paul Smith
On Sun, 2021-07-25 at 16:04 -0400, Dmitry Goncharov wrote: > > It's clear that /dev/null is a special case, however, because the > > order in which data is written to it cannot be detected so what's > > the point in preserving any order? > > Maybe Mike can tell us. Based on the bug report I

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

2021-07-25 Thread Dmitry Goncharov via Bug reports and discussion for GNU make
On Sun, Jul 25, 2021 at 3:25 PM Paul Smith wrote: > I have no problem with make refusing to write to a device that's locked > in general. If users don't want that to happen, they can just not use > the -O option. True, as long as the user knows that when -O is specified make is going to lock

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

2021-07-25 Thread Paul Smith
On Sun, 2021-07-25 at 15:25 -0400, Paul Smith wrote: > There's no reason that those two disjoint sets of output need to be > synchronized WITH EACH OTHER to meet the goal of the -O option. Given > the choice between allowing output to go to these two different > locations in parallel vs.

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

2021-07-25 Thread Paul Smith
On Sun, 2021-07-25 at 13:11 -0400, Dmitry Goncharov wrote: > On Sun, Jul 25, 2021 at 10:03 AM Paul Smith wrote: > > Writing to things like /dev/lp0 SHOULD be locked, IMO: you don't > > want multiple concurrent writers to your printers or your terminal! > > The user intentionally redirects make

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

2021-07-25 Thread Dmitry Goncharov
Additional Item Attachment, bug #60774 (project make): File name: sv_60774_output_sync_deadlock_fix2.diff Size:6 KB ___ Reply to this item at:

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

2021-07-25 Thread Dmitry Goncharov via Bug reports and discussion for GNU make
On Sun, Jul 25, 2021 at 10:03 AM Paul Smith wrote: > Writing to > things like /dev/lp0 SHOULD be locked, IMO: you don't want multiple > concurrent writers to your printers or your terminal! The user intentionally redirects make to a printer along with another tool. Should make be smarter than

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

2021-07-25 Thread Dmitry Goncharov via Bug reports and discussion for GNU make
On Sun, Jul 25, 2021 at 3:49 AM Eli Zaretskii wrote: > > Follow-up Comment #8, bug #60774 (project make): > > Why did you remove the code which reused the mutex passed from the parent > Make? Eli, i don't think i removed any code, other than the global variable mutex_handle. Atleast, not

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

2021-07-25 Thread Dmitry Goncharov
Follow-up Comment #9, bug #60774 (project make): i was able to test on windows and attached a proposed patch. The patch does what is described in update 3. ___ Reply to this item at:

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

2021-07-25 Thread Dmitry Goncharov
Additional Item Attachment, bug #60774 (project make): File name: sv_60774_output_sync_deadlock_fix.diff Size:6 KB ___ Reply to this item at:

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

2021-07-25 Thread Paul Smith
On Sat, 2021-07-24 at 20:35 -0400, Dmitry Goncharov wrote: > On Sat, Jul 24, 2021 at 3:02 PM David Boyce > wrote: > > I can’t think of a file other than /dev/null which would > > appropriately be shared with unrelated processes in a “w” (write) > > condition. > > /dev/zero, /dev/lp0, /dev/lp1,

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

2021-07-25 Thread Eli Zaretskii
Follow-up Comment #8, bug #60774 (project make): Why did you remove the code which reused the mutex passed from the parent Make? ___ Reply to this item at:

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

2021-07-25 Thread Eli Zaretskii
> From: Dmitry Goncharov > Date: Sat, 24 Jul 2021 22:03:37 -0400 > Cc: Mike Frysinger , Paul Smith , > bo...@kolpackov.net, > bug-make > > Wanted to test that windows this still works with this change. > > So, i followed instructions in README.W32. > Installed mingw gcc. Copied

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

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

2021-07-21 Thread Mike Frysinger
Follow-up Comment #1, bug #60774 (project make): i thought i had included it originally, but i think it might be a change in the kernel version. i'm testing against linux-5.10 & glibc-2.31. ___ Reply to this item at:

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

2021-06-11 Thread Mike Frysinger
URL: Summary: make hangs on fcntl lock when using -O and stdout is /dev/null Project: make Submitted by: vapier Submitted on: Fri 11 Jun 2021 06:24:02 PM EDT Severity: 3 - Normal