*Synopsis*: Recursive function+command substitutions terminate shell after 257 iterations
Due to a change requested by <User 1-1SURPB>, <User 1-1SURPB> is now the responsible engineer for: CR 6769332 changed on Jun 17 2009 by <User 1-1SURPB> === Field ============ === New Value ============= === Old Value ============= Evaluation New Note Hook 5 <email address omitted> Introduced in Build snv_72 Introduced in Release solaris_nevada Keyword oss-sponsor Keyword oss-request Responsible Engineer <User 1-1SURPB> Root Cause Insufficient Testing See Also 6793763 Status 6-Fix Understood 1-Dispatched Targeted Release solaris_nevada ====================== =========================== =========================== *Change Request ID*: 6769332 *Synopsis*: Recursive function+command substitutions terminate shell after 257 iterations Product: solaris Category: shell Subcategory: korn93 Type: RFE Subtype: Status: 6-Fix Understood Substatus: Priority: 3-Medium Introduced In Release: solaris_nevada Introduced In Build: snv_72 Responsible Engineer: <User 1-1SURPB> 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: Fixed In Build: Integrated In Build: Verified In Build: See Also: 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> === *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 ======================================