*Synopsis*: Recursive function+command substitutions terminate shell after 257 iterations
CR 6769332 changed on Nov 23 2009 by <User 1-2S67RN> === Field ============ === New Value ============= === Old Value ============= Integrated in Build snv_128 Status 10-Fix Delivered 8-Fix Available ====================== =========================== =========================== *Change Request ID*: 6769332 *Synopsis*: Recursive function+command substitutions terminate shell after 257 iterations Product: solaris Category: shell Subcategory: korn93 Type: RFE Subtype: Status: 10-Fix Delivered Substatus: Priority: 3-Medium Introduced In Release: solaris_nevada Introduced In Build: snv_72 Responsible Engineer: <User 1-7MTUEB> Keywords: opensolaris, oss-request, oss-sponsor === *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: solaris_nevada Commit To Fix In Build: snv_128 Fixed In Build: snv_128 Integrated In Build: snv_128 Verified In Build: See Also: 6437624, 6793763 Duplicate of: Hooks: Hook1: Hook2: Hook3: Hook4: Hook5: <email address omitted> Hook6: <email address omitted> Program Management: Root Cause: Insufficient Testing 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 4-Defer 2009-03-18 14:24:37 GMT+00:00 <User 1-5Q-9633> 1-Dispatched 2009-03-18 14:25:00 GMT+00:00 <User 1-5Q-9633> 6-Fix Understood 2009-06-17 12:11:37 GMT+00:00 <User 1-1SURPB> 7-Fix in Progress 2009-10-23 17:30:17 GMT+00:00 <User 1-7MTUEB> 8-Fix Available 2009-10-28 18:23:30 GMT+00:00 <User 1-5HNZ8F> 10-Fix Delivered 2009-11-23 05:16:49 GMT+00:00 <User 1-2S67RN> === *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 ======================================