Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 681478

Summary: ( ) compound list is altering environment
Product: Red Hat Enterprise Linux 6 Reporter: Wolf-Dietrich <wolf-dietrich>
Component: kshAssignee: Michal Hlavinka <mhlavink>
Status: CLOSED ERRATA QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 6.0CC: mfranc, ovasik, prc
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Previously, a ( ) compound list did not always use a copy of the environment which caused the original environment to be altered. Scripts could behave unexpectedly because their variables could be changed. With this update, a copy of the environment is always used for a ( ) compound list; thus, the original environment is not affected by commands from the ( ) compound list.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 13:50:27 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:
Attachments:
Description Flags
mini scripts to be sourced and Readme (description) none

Description Wolf-Dietrich 2011-03-02 10:05:46 UTC
Created attachment 481832 [details]
mini scripts to be sourced and Readme (description)

Description of problem:

( . ./xx )  ##### first call modifies local environment
( . ./xx )  ##### secon call core dump sigsev 

Version-Release number of selected component:
Name        : ksh                          
Relocations : (not relocatable)
Version     : 20100621                          
Vendor      : Red Hat, Inc.
Release     : 2.el6                         
Build Date  : Tue Jun 29 14:40:26 2010
Install Date: Fri Jan 28 16:03:02 2011         
Build Host  : ls20-bc2-13.build.redhat.com
Group       : System Environment/Shells     
Source RPM  : ksh-20100621-2.el6.src.rpm
Size        : 1478609                          
Signature   : RSA/8, Mon Aug 16 17:39:17 2010, Key ID 199e2f91fd431d51
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>


How reproducible:
unpack attachment (tar)
see Readme
call ksh and follow instructions from Readme


Expected results:
current environemnt must not be modified


Additional info:
works in redhat 5.5 
ubuntu all versions
SunOS 9,10
....

Comment 2 Michal Hlavinka 2011-03-02 12:35:35 UTC
(In reply to comment #0)
> ( . ./xx )  ##### first call modifies local environment
> ( . ./xx )  ##### secon call core dump sigsev 

this is already fixed in new ksh package prepared for next rhel6 update

> How reproducible:
> unpack attachment (tar)
> see Readme
> call ksh and follow instructions from Readme

the "y1" reproducer is not fixed yet, I'll look at it

> Additional info:
> works in redhat 5.5 
> ubuntu all versions
> SunOS 9,10
> ....

it works there because they use older ksh versions which suffer from other bugs

"y1" reproducer bug got introduced between 2010-03-09 (working) and 2010-05-27 (broken)

Comment 3 Michal Hlavinka 2011-03-02 13:02:46 UTC
simplified reproducers for "y1" bug:
a) 
RET=$(ksh -c '( function fx { export X=123;  } ; fx; ); echo $X')
[ -z "$RET" ] && echo "works fine" || echo "bug present"

b)
RET=$(ksh -c 'echo "/bin/true; function fx { export X=123; } ; fx;" >/tmp/kshtest; ( . /tmp/kshtest >/dev/null  ); echo $X; rm -f /tmp/kshtest')
[ -z "$RET" ] && echo "works fine" || echo "bug present"

Comment 9 Martin Prpič 2011-03-16 16:01:16 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Previously, a ( ) compound list did not always use a copy of the environment which caused the original environment to be altered. Scripts could behave unexpectedly because their variables could be changed. With this update, a copy of the environment is always used for a ( ) compound list; thus, the original environment is not affected by commands from the ( ) compound list.

Comment 10 errata-xmlrpc 2011-05-19 13:50:27 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-2011-0645.html