exporting fixed with variable corrupted its data (#1192027)

This commit is contained in:
Michal Hlavinka 2015-03-06 14:13:19 +01:00
parent d679af8dc6
commit 569b398693
2 changed files with 39 additions and 5 deletions

29
ksh-20120801-xufix.patch Normal file
View File

@ -0,0 +1,29 @@
diff -up ksh-20120801/src/cmd/ksh93/bltins/typeset.c.xufix ksh-20120801/src/cmd/ksh93/bltins/typeset.c
--- ksh-20120801/src/cmd/ksh93/bltins/typeset.c.xufix 2015-02-03 14:47:23.266022137 +0100
+++ ksh-20120801/src/cmd/ksh93/bltins/typeset.c 2015-02-03 14:47:23.308022046 +0100
@@ -93,6 +93,8 @@ int b_readonly(int argc,char *argv[],
memset((void*)&tdata,0,sizeof(tdata));
tdata.sh = context->shp;
tdata.aflag = '-';
+ /* do not change size */
+ tdata.argnum = -1;
while((flag = optget(argv,*command=='e'?sh_optexport:sh_optreadonly))) switch(flag)
{
case 'p':
diff -up ksh-20120801/src/cmd/ksh93/sh/name.c.xufix ksh-20120801/src/cmd/ksh93/sh/name.c
--- ksh-20120801/src/cmd/ksh93/sh/name.c.xufix 2015-02-03 14:47:23.281022105 +0100
+++ ksh-20120801/src/cmd/ksh93/sh/name.c 2015-02-03 14:52:08.768404194 +0100
@@ -3019,10 +3019,12 @@ void nv_newattr (register Namval_t *np,
nv_onattr(np,NV_EXPORT);
sh_envput(shp->env,np);
}
- if((n^newatts)==NV_EXPORT)
+ if((n^newatts)==NV_EXPORT && size==-1)
return;
}
oldsize = nv_size(np);
+ if (size == -1)
+ size = oldsize;
if((size==oldsize|| (n&NV_INTEGER)) && !trans && ((n^newatts)&~NV_NOCHANGE)==0)
{
if(size)

View File

@ -9,7 +9,7 @@ Group: System Environment/Shells
#CPL everywhere else (for KSH itself) #CPL everywhere else (for KSH itself)
License: CPL License: CPL
Version: %{releasedate} Version: %{releasedate}
Release: 22%{?dist} Release: 23%{?dist}
Source0: http://www.research.att.com/~gsf/download/tgz/ast-ksh.%{release_date}.tgz Source0: http://www.research.att.com/~gsf/download/tgz/ast-ksh.%{release_date}.tgz
Source1: http://www.research.att.com/~gsf/download/tgz/INIT.%{release_date}.tgz Source1: http://www.research.att.com/~gsf/download/tgz/INIT.%{release_date}.tgz
Source2: kshcomp.conf Source2: kshcomp.conf
@ -22,6 +22,9 @@ Source5: expectedresults.log
# don't use not wanted/needed builtins - Fedora/RHEL specific # don't use not wanted/needed builtins - Fedora/RHEL specific
Patch1: ksh-20070328-builtins.patch Patch1: ksh-20070328-builtins.patch
# fix regression test suite to be usable during packagebuild - Fedora/RHEL specific
Patch2: ksh-20100826-fixregr.patch
# fedora/rhel specific, rhbz#619692 # fedora/rhel specific, rhbz#619692
Patch6: ksh-20080202-manfix.patch Patch6: ksh-20080202-manfix.patch
@ -53,9 +56,6 @@ Patch27: ksh-20120801-macro.patch
# not completely upstream yet, rhbz#858263 # not completely upstream yet, rhbz#858263
Patch29: ksh-20130628-longer.patch Patch29: ksh-20130628-longer.patch
# fix regression test suite to be usable during packagebuild - Fedora/RHEL specific
Patch99: ksh-20100826-fixregr.patch
# for ksh <= 2013-07-19, rhbz#982142 # for ksh <= 2013-07-19, rhbz#982142
Patch30: ksh-20120801-mlikfiks.patch Patch30: ksh-20120801-mlikfiks.patch
@ -119,6 +119,7 @@ Patch49: ksh-20120801-cdfix3.patch
# sent upstream, rhbz#1116506 # sent upstream, rhbz#1116506
Patch50: ksh-20120801-locking.patch Patch50: ksh-20120801-locking.patch
Patch51: ksh-20130613-cdfix4.patch Patch51: ksh-20130613-cdfix4.patch
Patch52: ksh-20120801-xufix.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Conflicts: pdksh Conflicts: pdksh
@ -139,9 +140,9 @@ with "sh" (the Bourne Shell).
%setup -q -c %setup -q -c
%setup -q -T -D -a 1 %setup -q -T -D -a 1
%patch1 -p1 -b .builtins %patch1 -p1 -b .builtins
%patch2 -p1 -b .fixregr
%patch6 -p1 -b .manfix %patch6 -p1 -b .manfix
%patch17 -p1 -b .pathvar %patch17 -p1 -b .pathvar
%patch99 -p1 -b .fixregr
%patch18 -p1 -b .fdstatus %patch18 -p1 -b .fdstatus
%patch19 -p1 -b .rmdirfix %patch19 -p1 -b .rmdirfix
%patch20 -p1 -b .cdfix %patch20 -p1 -b .cdfix
@ -175,6 +176,7 @@ with "sh" (the Bourne Shell).
%patch49 -p1 -b .cdfix3 %patch49 -p1 -b .cdfix3
%patch50 -p1 -b .locking %patch50 -p1 -b .locking
%patch51 -p1 -b .cdfix4 %patch51 -p1 -b .cdfix4
%patch52 -p1 -b .xufix
#/dev/fd test does not work because of mock #/dev/fd test does not work because of mock
sed -i 's|ls /dev/fd|ls /proc/self/fd|' src/cmd/ksh93/features/options sed -i 's|ls /dev/fd|ls /proc/self/fd|' src/cmd/ksh93/features/options
@ -275,6 +277,9 @@ fi
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%changelog %changelog
* Fri Mar 06 2015 Michal Hlavinka <mhlavink@redhat.com> - 20120801-23
- exporting fixed with variable corrupted its data (#1192027)
* Fri Feb 27 2015 Michal Hlavinka <mhlavink@redhat.com> - 20120801-22 * Fri Feb 27 2015 Michal Hlavinka <mhlavink@redhat.com> - 20120801-22
- ksh hangs when command substitution containing a pipe fills out the pipe buffer (#1121204) - ksh hangs when command substitution containing a pipe fills out the pipe buffer (#1121204)