The following issue has been SUBMITTED. ====================================================================== https://austingroupbugs.net/view.php?id=1772 ====================================================================== Reported By: geoffclare Assigned To: ====================================================================== Project: 1003.1(2016/18)/Issue7+TC2 Issue ID: 1772 Category: Shell and Utilities Type: Clarification Requested Severity: Objection Priority: normal Status: New Name: Geoff Clare Organization: The Open Group User Reference: Section: make Page Number: 2971 Line Number: 98562 Interp Status: --- Final Accepted Text: ====================================================================== Date Submitted: 2023-08-21 09:58 UTC Last Modified: 2023-08-21 09:58 UTC ====================================================================== Summary: make's ASYNCHRONOUS EVENTS has several problems Description: The ASYNCHRONOUS EVENTS section for the make utility says:<blockquote>If not already ignored, make shall trap SIGHUP, SIGTERM, SIGINT, and SIGQUIT and remove the current target unless the target is a directory or the target is a prerequisite of the special target .PRECIOUS or unless one of the -n, -p, or -q options was specified. Any targets removed in this manner shall be reported in diagnostic messages of unspecified format, written to standard error. After this cleanup process, if any, make shall take the standard action for all other signals.</blockquote>There are several problems with this...
1. It says how SIGHUP, SIGTERM, SIGINT, and SIGQUIT are handled when several conditions are all met, but says nothing about how they are handled when any of those conditions is not met. 2. It assumes there is always a "current target". This is not the case if, for example, a signal is received while "make -f -" is reading a makefile supplied on standard input. 3. It requires a "diagnostic message" to be written to standard error, which means (as per 1.4 Utility Description Defaults) that the exit status must indicate that an error occurred, but some implementations instead set the signal to default and re-signal the process to terminate it. 4. It is not clear how the phrase "After this cleanup process, if any" is supposed to be understood. Since "this" refers back to a previously described cleanup process of removing the current target, is "if any" supposed to be making this removal optional for signals other than SIGHUP, SIGTERM, SIGINT, and SIGQUIT? If the removal is allowed it would have to be without the diagnostic message, which seems unlikely to be what was intended. And if removal is allowed for other signals, that includes signals that do not terminate the process (such as SIGTSTP and SIGCONT), which obviously would not have been intended. None of the implementations I tried removed the target for other signals. (I tried Solaris, GNU, and Debian's BSD-derived bmake, but not a "real" BSD make.) Finally, GNU make doesn't do the specified target removal for SIGHUP, SIGTERM, SIGINT, and SIGQUIT. This could either be treated as a non-conformance in GNU make that they should put right (OPTION 1), or we could allow either behaviour in the standard (OPTION 2). Desired Action: On page 2339 line 74433 section 1.4, change:<blockquote><b>Default Behavior:</b> When this section is listed as ``Default.'', or it refers to ``the standard action for all other signals; see Section 1.4 (on page 2336)'' it means ...</blockquote>to:<blockquote><b>Default Behavior:</b> When this section is listed as ``Default.'', or it refers to ``the standard action'' for any signal, it means ...</blockquote> On page 2971 line 98562 section make, after applying bug 523 replace the text of the ASYNCHRONOUS EVENTS section with:<blockquote><b>OPTION 1</b> For SIGHUP, SIGINT, SIGQUIT, and SIGTERM signals, if the signal was not inherited as ignored, none of the <b>-n</b>, <b>-p</b>, or <b>-q</b> options was specified, <i>make</i> is currently processing a target or inference rule, the current target is not a directory, and the target is not a prerequisite of the special targets <b>.PHONY</b> or <b>.PRECIOUS</b>: <ul><li><i>make</i> shall catch the signal and remove the current target; any targets removed in this manner shall be reported in diagnostic or informational messages of unspecified format, written to standard error.</li> <li>If <i>make</i> writes a diagnostic message to standard error, it shall exit with a status that indicates an error occurred; otherwise, it shall set the signal to default and re-signal itself.</li> </ul>In all other circumstances, <i>make</i> shall take the standard action for all signals; see [xref to 1.4]. <b>OPTION 2</b> As above but with "may catch the signal" instead of "shall catch the signal"</blockquote> On page 2972 line 98577 section make, change STDERR from:<blockquote>The standard error shall be used only for diagnostic messages.</blockquote>to:<blockquote>The standard error shall be used for diagnostic messages and may be used for informational messages about target removals (see ASYNCHRONOUS EVENTS).</blockquote> ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2023-08-21 09:58 geoffclare New Issue 2023-08-21 09:58 geoffclare Name => Geoff Clare 2023-08-21 09:58 geoffclare Organization => The Open Group 2023-08-21 09:58 geoffclare Section => make 2023-08-21 09:58 geoffclare Page Number => 2971 2023-08-21 09:58 geoffclare Line Number => 98562 2023-08-21 09:58 geoffclare Interp Status => --- ======================================================================
