A NOTE has been added to this issue. ====================================================================== https://austingroupbugs.net/view.php?id=1876 ====================================================================== Reported By: calestyo Assigned To: ====================================================================== Project: 1003.1(2024)/Issue8 Issue ID: 1876 Category: Shell and Utilities Type: Clarification Requested Severity: Editorial Priority: normal Status: New Name: Christoph Anton Mitterer Organization: User Reference: Section: 2.15 Special Built-In Utilities Page Number: 2554 Line Number: 83295, ff. Interp Status: --- Final Accepted Text: ====================================================================== Date Submitted: 2024-11-18 23:54 UTC Last Modified: 2024-11-19 10:45 UTC ====================================================================== Summary: clarify, whether a trap action that is executed from a context where set -e is ignored, would have set -e ignored, too ======================================================================
---------------------------------------------------------------------- (0006962) geoffclare (manager) - 2024-11-19 10:45 https://austingroupbugs.net/view.php?id=1876#c6962 ---------------------------------------------------------------------- I think what's been missed here is a subtlety in this quoted text: > When a signal for which a trap has been set is > received while the shell is waiting for the completion > of a utility executing a foreground command, the trap > associated with that signal shall not be executed until > after the foreground command has completed. Note it says "after the foreground command has completed", i.e. the whole command has completed, not just the utility that the shell was waiting for. In the tested script, the foreground command is "sleep 100 || :". The sleep is terminated by the SIGINT and the shell then completes execution of the foreground command by evaluating the || condition and executing the ":" (because the sleep did not succeed). Only then does it execute the trap action, at which point the AND-OR list exception for set -e no longer applies. So the standard requires the behaviour exhibited by bash and dash in the test. The phrase "a utility executing a foreground command" is a little odd, as strictly speaking the shell is the only utility which can execute a foreground command. It should be changed to something like "a utility executing as part (or all) of a foreground command". Issue History Date Modified Username Field Change ====================================================================== 2024-11-18 23:54 calestyo New Issue 2024-11-18 23:54 calestyo Name => Christoph Anton Mitterer 2024-11-18 23:54 calestyo Section => 2.15 Special Built-In Utilities 2024-11-18 23:54 calestyo Page Number => 2554 2024-11-18 23:54 calestyo Line Number => 83295, ff. 2024-11-19 10:45 geoffclare Note Added: 0006962 ======================================================================
