A NOTE has been added to this issue. 
====================================================================== 
http://austingroupbugs.net/view.php?id=1150 
====================================================================== 
Reported By:                kre
Assigned To:                
====================================================================== 
Project:                    1003.1(2016)/Issue7+TC2
Issue ID:                   1150
Category:                   Shell and Utilities
Type:                       Omission
Severity:                   Editorial
Priority:                   normal
Status:                     New
Name:                       Robert Elz 
Organization:                
User Reference:              
Section:                    2.6.3 
Page Number:                2357 - 2358 
Line Number:                75182 - 75224 
Interp Status:              --- 
Final Accepted Text:         
====================================================================== 
Date Submitted:             2017-06-16 01:33 UTC
Last Modified:              2017-06-16 15:52 UTC
====================================================================== 
Summary:                    exit status of command substitution not properly
specified
====================================================================== 

---------------------------------------------------------------------- 
 (0003774) joerg (reporter) - 2017-06-16 15:52
 http://austingroupbugs.net/view.php?id=1150#c3774 
---------------------------------------------------------------------- 
Re: http://austingroupbugs.net/view.php?id=1150#c3773

it seems that many shells are broken here...

Does anybody disagree that:

   $SHELL -c 'f() { (exit 3); return $( exit 1); } ; f; echo $?'

should print "3"?

The reason for the diverging behavior is the places where
the shells implement checkpoints to save the current value
of "exitcode" for the next expansion of $?.

The Bourne Shell and it's childs have such a checkpoint at the
end of the interpreter function and this function is called
from the command substitution.....

ksh88 removed one such checkpoint after the wait() for the
$(cmd), but left the checkpoint in the interpreter function... 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2017-06-16 01:33 kre            New Issue                                    
2017-06-16 01:33 kre            Name                      => Robert Elz      
2017-06-16 01:33 kre            Section                   => 2.6.3           
2017-06-16 01:33 kre            Page Number               => 2357 - 2358     
2017-06-16 01:33 kre            Line Number               => 75182 - 75224   
2017-06-16 01:46 kre            Note Added: 0003766                          
2017-06-16 06:10 stephane       Note Added: 0003767                          
2017-06-16 09:38 joerg          Note Added: 0003768                          
2017-06-16 09:54 joerg          Note Added: 0003769                          
2017-06-16 10:06 kre            Note Added: 0003770                          
2017-06-16 10:16 joerg          Note Added: 0003771                          
2017-06-16 10:21 joerg          Note Edited: 0003771                         
2017-06-16 11:07 kre            Note Added: 0003772                          
2017-06-16 15:38 stephane       Note Added: 0003773                          
2017-06-16 15:52 joerg          Note Added: 0003774                          
======================================================================


Reply via email to