A NOTE has been added to this issue. 
====================================================================== 
http://austingroupbugs.net/view.php?id=1211 
====================================================================== 
Reported By:                kre
Assigned To:                
====================================================================== 
Project:                    1003.1(2016)/Issue7+TC2
Issue ID:                   1211
Category:                   Shell and Utilities
Type:                       Clarification Requested
Severity:                   Objection
Priority:                   normal
Status:                     New
Name:                       Robert Elz 
Organization:                
User Reference:              
Section:                    XCU 2.14 -- trap special builtin 
Page Number:                2420 
Line Number:                77514 - 77526 
Interp Status:              --- 
Final Accepted Text:         
====================================================================== 
Date Submitted:             2018-09-28 02:22 UTC
Last Modified:              2019-04-04 16:36 UTC
====================================================================== 
Summary:                    "trap" (with no args) specification does not match
reality
====================================================================== 

---------------------------------------------------------------------- 
 (0004355) geoffclare (manager) - 2019-04-04 16:36
 http://austingroupbugs.net/view.php?id=1211#c4355 
---------------------------------------------------------------------- 
Change the sentence starting on line 77514 from:<blockquote>The <i>trap</i>
command with no operands shall write to standard output a list of commands
associated with each condition.</blockquote>to:<blockquote>The <i>trap</i>
command with no operands shall write to standard output a list of commands
associated with each condition which is not in its default
state.</blockquote>
Change the sentence at line 77522 from:<blockquote>The shell shall format
the output, including the proper use of quoting, so that it is suitable for
reinput to the shell as commands that achieve the same trapping
results.</blockquote>to:<blockquote>The shell shall format the output,
including the proper use of quoting, so that it is suitable for reinput to
the shell as commands that achieve the same trapping results for those
traps that had previously been altered.</blockquote>
And also change the example at lines 77524-6
from:<blockquote><pre>save_traps=$(trap)
...
eval
"$save_traps"</pre></blockquote>to:<blockquote><pre>save_traps=$(trap)
trap "some command" INT QUIT
save_traps="trap - INT QUIT; $save_traps"

...

eval "$save_traps"</pre></blockquote>
On page 2422 line 77564, change APPLICATION USAGE
from:<blockquote>None.</blockquote>to:<blockquote>Since <i>trap</i> with no
operands does not output commands to restore traps that are currently set
to default, these need to be restored separately. The DESCRIPTION section
shows one example, but the method it uses relies on hard-coding the
commands to reset the traps that are being set.  A more general approach
would be:<pre>
save_traps=$(trap)
...
for sig in EXIT $( kill -l )
do
     case "$sig" in
     SIGKILL | KILL | sigkill | kill | SIGSTOP | STOP | sigstop | stop)
              ;;
     *) trap - $sig
              ;;
     esac
done
eval "$save_traps"</pre>
However, this has a race condition since it first sets all traps (that can
be set) to default and then restores those that were not previously set to
default.</blockquote>
On page 2423, line 77606 (FUTURE DIRECTIONS)
change:<blockquote>None.</blockquote>to:<blockquote>A future version of
this standard may define a mechanism to obtain the current setting of all
traps  (including those in their default state).</blockquote> 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2018-09-28 02:22 kre            New Issue                                    
2018-09-28 02:22 kre            Name                      => Robert Elz      
2018-09-28 02:22 kre            Section                   => XCU 2.14 -- trap
special builtin
2018-09-28 02:22 kre            Page Number               => 2420            
2018-09-28 02:22 kre            Line Number               => 77514 - 77526   
2018-09-28 03:20 kre            Tag Attached: tc3-2008                       
2018-09-28 03:20 kre            Tag Attached: issue8                         
2018-09-28 03:20 kre            Tag Detached: tc3-2008                       
2018-09-28 03:21 kre            Tag Detached: issue8                         
2018-09-28 03:23 kre            Note Added: 0004132                          
2018-09-28 08:44 geoffclare     Note Added: 0004133                          
2018-09-28 08:53 geoffclare     Note Added: 0004134                          
2018-09-28 09:04 geoffclare     Note Edited: 0004133                         
2018-09-28 09:05 geoffclare     Note Deleted: 0004134                        
2018-09-28 10:25 kre            Note Added: 0004135                          
2018-09-28 10:40 kre            Note Added: 0004136                          
2019-04-04 16:36 geoffclare     Note Added: 0004355                          
======================================================================


Reply via email to