Bug 681478 - ( ) compound list is altering environment
Summary: ( ) compound list is altering environment
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: ksh
Version: 6.0
Hardware: x86_64
OS: Linux
unspecified
urgent
Target Milestone: rc
: ---
Assignee: Michal Hlavinka
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-03-02 10:05 UTC by Wolf-Dietrich
Modified: 2018-11-14 13:49 UTC (History)
3 users (show)

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.
Clone Of:
Environment:
Last Closed: 2011-05-19 13:50:27 UTC
Target Upstream Version:


Attachments (Terms of Use)
mini scripts to be sourced and Readme (description) (1.02 KB, application/x-gzip)
2011-03-02 10:05 UTC, Wolf-Dietrich
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0645 0 normal SHIPPED_LIVE ksh bug fix and enhancement update 2011-05-18 17:55:36 UTC

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


Note You need to log in before you can comment on or make changes to this bug.