A NOTE has been added to this issue. 
====================================================================== 
https://austingroupbugs.net/view.php?id=1602 
====================================================================== 
Reported By:                kre
Assigned To:                
====================================================================== 
Project:                    Issue 8 drafts
Issue ID:                   1602
Category:                   Shell and Utilities
Type:                       Omission
Severity:                   Objection
Priority:                   normal
Status:                     New
Name:                       Robert Elz 
Organization:                
User Reference:              
Section:                    XCU 2.14 exit   XCU 2.14 return 
Page Number:                2369, 2379 
Line Number:                76750, 77069 
Final Accepted Text:         
====================================================================== 
Date Submitted:             2022-08-23 16:33 UTC
Last Modified:              2022-08-25 01:10 UTC
====================================================================== 
Summary:                    No definition of "executed in a trap action"
====================================================================== 

---------------------------------------------------------------------- 
 (0005943) hvd (reporter) - 2022-08-25 01:10
 https://austingroupbugs.net/view.php?id=1602#c5943 
---------------------------------------------------------------------- 
Your proposed behaviour actually does suggest the same behaviour for exit
and return, and the same wording could be used for both. Something along
the lines of simply

  If the [exit/return] command would cause the end of execution of a trap
action, the last command is considered to be the command that executed
immediately preceding the trap action.

would cover it. I agree that this behaviour would be sane and if POSIX is
changed to require or allow this, I have no problem changing my shell to
implement this. However, while it is unclear to me what the POSIX wording
currently requires, I believe there is no legitimate reading of the current
wording that matches your expectations; this would be a change, not a
clarification.

Note that your proposed behaviour is to say that

  trap ':; (exit); echo $?' EXIT; false

will be required to print 0, as exit is not executed in the same execution
environment as that in which the trap action was executed. My shell does
print 0, yours prints 1 (tested with the system shell of yesterday's NetBSD
amd64 installation CD image), as does dash (which my shell is based on).
Please actually check before dismissing others' work as absurd or insane. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2022-08-23 16:33 kre            New Issue                                    
2022-08-23 16:33 kre            Name                      => Robert Elz      
2022-08-23 16:33 kre            Section                   => XCU 2.14 exit   XCU
2.14 return
2022-08-23 16:33 kre            Page Number               => 2369, 2379      
2022-08-23 16:33 kre            Line Number               => 76750, 77069    
2022-08-23 18:11 kre            Note Added: 0005941                          
2022-08-23 18:27 kre            Note Added: 0005942                          
2022-08-25 01:10 hvd            Note Added: 0005943                          
======================================================================


  • [Issue 8 dra... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [Issue ... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [Issue ... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [Issue ... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [Issue ... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [Issue ... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [Issue ... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [Issue ... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [Issue ... Austin Group Bug Tracker via austin-group-l at The Open Group

Reply via email to