Bug 507562

Summary: ksh typeset does not assign value in an asynchronously called function
Product: Red Hat Enterprise Linux 5 Reporter: Tomas Smetana <tsmetana>
Component: kshAssignee: Michal Hlavinka <mhlavink>
Status: CLOSED ERRATA QA Contact: BaseOS QE <qe-baseos-auto>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 5.3CC: cward, kvolny, rvokal, sghosh, tao
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
in the last ksh version, the function nesting counter was zeroed after forking. Therefore, typeset did not assign values in asynchronously called functions. This is now fixed.
Story Points: ---
Clone Of:
: 509326 (view as bug list) Environment:
Last Closed: 2009-09-02 09:10:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 509326, 510712, 513501    
Attachments:
Description Flags
Proposed patch none

Description Tomas Smetana 2009-06-23 10:30:58 UTC
Description of problem:
Assume the following script:
======== 8< ========
#!/bin/ksh

testfn() {
    typeset var=val
    echo "var = $var"
}

function wrap_fork_testfn
{
    testfn &
}

echo "=== call wrapper forking function"
wrap_fork_testfn 
======== 8< ========

Version-Release number of selected component (if applicable):
ksh-20080202-13

How reproducible:
always

Steps to Reproduce:
1. Run the script from above
2. Look at the output

Actual results:
=== call wrapper forking function
var =

Expected results:
=== call wrapper forking function
var = val

Additional info:
This is caused by a bug in ksh xec.c where the function nesting counter is being zeroed after forking.

Comment 1 Tomas Smetana 2009-06-23 10:32:27 UTC
Created attachment 349075 [details]
Proposed patch

Comment 2 Tomas Smetana 2009-06-23 10:33:37 UTC
Just a note: this bug has been fixed in the ksh-2008-07-24 beta release.

Comment 12 Ruediger Landmann 2009-08-13 00:59:28 UTC
Release note added. If any revisions are required, please set the 
"requires_release_notes" flag to "?" and edit the "Release Notes" field accordingly.
All revisions will be proofread by the Engineering Content Services team.

New Contents:
in the last ksh version, the function nesting counter was zeroed after
forking. Therefore, typeset did not assign values in asynchronously called
functions. This is now fixed.

Comment 13 errata-xmlrpc 2009-09-02 09:10:53 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-1256.html