*Synopsis*: Recursive function+command substitutions terminate shell after 257
iterations
CR 6769332 changed on Nov 10 2008 by <User 1-5Q-1267>
=== Field ============ === New Value ============= === Old Value =============
Category shell opensolaris
SubCategory korn93 triage-queue
====================== =========================== ===========================
*Change Request ID*: 6769332
*Synopsis*: Recursive function+command substitutions terminate shell after 257
iterations
Product: solaris
Category: shell
Subcategory: korn93
Type: RFE
Subtype:
Status: 1-Dispatched
Substatus:
Priority: 3-Medium
Introduced In Release:
Introduced In Build:
Responsible Engineer:
Keywords: opensolaris
=== *Description* ============================================================
Category
shell
Sub-Category
korn
Description
Recursive function+command substitutions (e.g. func1() { x=$( func2 ) ; } ;
x=$( func1 ) ) terminate the ksh93 shell after 257 iterations with a exit code
of "0" (it seems the shell just "quits" after the last "return 0" statement in
the function).
Running the attached testcase terminates the shell after 257 iterations (g=257
in the script) while 256 iterations (replace "257" with "256" in the script)
just works fine.
The same testcase works Ok in ksh88 (=/usr/bin/ksh in Solaris 10U5)
Frequency
Always
Regression
No
Steps to Reproduce
Execute the testcase.
Expected Result
The script should output "done" and return the exit code 0.
Actual Result
No messsge. Exit code "0".
Error Message(s)
None (exit code is "0").
Test Case
f1()
{
h=$1
(( h=h-1 ))
(( h <= 0 )) && return 0
x=$(f1 "$h" "$l" "$g" d e "$l") || print -u2 "$g/$h: fail"
return 0
}
l=""
g=257
i=0
while (( i < $g )) ; do
l="${l}x"
(( i=i+1 ))
done
f1 "$g" "$l" "$g" d e "$l" || print -u2 "$g: fail0"
print "done"
exit 0
Workaround
-
Submitter wants to work on bug
Yes
Additional configuration information
Solaris 11/B84
*** (#1 of 1): 2008-11-08 20:38:56 GMT+00:00 <User 1-F4SZV>
=== *Public Comments* ========================================================
=== *Workaround* =============================================================
=== *Additional Details* =====================================================
Targeted Release:
Commit To Fix In Build:
Fixed In Build:
Integrated In Build:
Verified In Build:
See Also:
Duplicate of:
Hooks:
Hook1:
Hook2:
Hook3:
Hook4:
Hook5:
Hook6: <email address omitted>
Program Management:
Root Cause:
Fix Affects Documentation: No
Fix Affects Localization: No
=== *History* ================================================================
Date Submitted: 2008-11-08 20:38:55 GMT+00:00
Submitted By: <User 1-F4SZV>
Status Changed Date Updated Updated By
=== *Service Request* ========================================================
Impact: Significant
Functionality: Secondary
Severity: 3
Product Name: solaris
Product Release: solaris_nevada
Product Build: snv_84
Operating System: solaris_nevada
Hardware: generic
Submitted Date: 2008-11-08 20:38:56 GMT+00:00
=== *Multiple Release (MR) Cluster* - 0 ======================================