diff --git a/ksh-20120801-crash.patch b/ksh-20120801-crash.patch index 37b7962..63eda72 100644 --- a/ksh-20120801-crash.patch +++ b/ksh-20120801-crash.patch @@ -1,6 +1,6 @@ diff -up ksh-20120801/src/cmd/ksh93/include/jobs.h.crash ksh-20120801/src/cmd/ksh93/include/jobs.h ---- ksh-20120801/src/cmd/ksh93/include/jobs.h.crash 2014-07-22 11:48:57.205062905 +0200 -+++ ksh-20120801/src/cmd/ksh93/include/jobs.h 2014-07-22 11:48:57.243062711 +0200 +--- ksh-20120801/src/cmd/ksh93/include/jobs.h.crash 2014-07-16 17:32:03.570057304 +0200 ++++ ksh-20120801/src/cmd/ksh93/include/jobs.h 2014-07-16 17:32:03.600057172 +0200 @@ -118,6 +118,7 @@ struct jobs char jobcontrol; /* turned on for real job control */ char waitsafe; /* wait will not block */ @@ -10,8 +10,8 @@ diff -up ksh-20120801/src/cmd/ksh93/include/jobs.h.crash ksh-20120801/src/cmd/ks unsigned char *freejobs; /* free jobs numbers */ #if SHOPT_COSHELL diff -up ksh-20120801/src/cmd/ksh93/sh/jobs.c.crash ksh-20120801/src/cmd/ksh93/sh/jobs.c ---- ksh-20120801/src/cmd/ksh93/sh/jobs.c.crash 2014-07-22 11:48:57.190062982 +0200 -+++ ksh-20120801/src/cmd/ksh93/sh/jobs.c 2014-07-22 11:48:57.243062711 +0200 +--- ksh-20120801/src/cmd/ksh93/sh/jobs.c.crash 2014-07-16 17:32:03.554057375 +0200 ++++ ksh-20120801/src/cmd/ksh93/sh/jobs.c 2014-07-16 17:32:03.600057172 +0200 @@ -1957,6 +1957,7 @@ again: { count = bp->count; @@ -21,8 +21,8 @@ diff -up ksh-20120801/src/cmd/ksh93/sh/jobs.c.crash ksh-20120801/src/cmd/ksh93/s } if(jp) diff -up ksh-20120801/src/cmd/ksh93/sh/subshell.c.crash ksh-20120801/src/cmd/ksh93/sh/subshell.c ---- ksh-20120801/src/cmd/ksh93/sh/subshell.c.crash 2014-07-22 11:48:57.234062758 +0200 -+++ ksh-20120801/src/cmd/ksh93/sh/subshell.c 2014-07-22 11:54:04.164491483 +0200 +--- ksh-20120801/src/cmd/ksh93/sh/subshell.c.crash 2014-07-16 17:32:03.593057203 +0200 ++++ ksh-20120801/src/cmd/ksh93/sh/subshell.c 2014-07-16 17:32:03.600057172 +0200 @@ -492,6 +492,7 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_ struct sh_scoped savst; struct dolnod *argsav=0; @@ -47,12 +47,12 @@ diff -up ksh-20120801/src/cmd/ksh93/sh/subshell.c.crash ksh-20120801/src/cmd/ksh else { + job.hack1_waitall=0; - if(comsub!=1 && shp->spid) - { - job_wait(shp->spid); + /* move tmp file to iop and restore sfstdout */ + iop = sfswap(sfstdout,NIL(Sfio_t*)); + if(!iop) diff -up ksh-20120801/src/cmd/ksh93/sh/xec.c.crash ksh-20120801/src/cmd/ksh93/sh/xec.c ---- ksh-20120801/src/cmd/ksh93/sh/xec.c.crash 2014-07-22 11:48:57.228062787 +0200 -+++ ksh-20120801/src/cmd/ksh93/sh/xec.c 2014-07-22 11:48:57.245062700 +0200 +--- ksh-20120801/src/cmd/ksh93/sh/xec.c.crash 2014-07-16 17:32:03.587057230 +0200 ++++ ksh-20120801/src/cmd/ksh93/sh/xec.c 2014-07-16 17:32:03.601057168 +0200 @@ -2125,7 +2125,7 @@ int sh_exec(register const Shnode_t *t, memset(exitval,0,job.waitall*sizeof(int)); } diff --git a/ksh-20120801-fd2lost.patch b/ksh-20120801-fd2lost.patch index 0605f6e..fbb7607 100644 --- a/ksh-20120801-fd2lost.patch +++ b/ksh-20120801-fd2lost.patch @@ -1,6 +1,6 @@ -diff -up ksh-20120801/src/cmd/ksh93/sh/macro.c.fd2lost ksh-20120801/src/cmd/ksh93/sh/macro.c ---- ksh-20120801/src/cmd/ksh93/sh/macro.c.fd2lost 2014-01-22 16:23:21.211658984 +0100 -+++ ksh-20120801/src/cmd/ksh93/sh/macro.c 2014-01-22 16:23:21.243658703 +0100 +diff -up ksh-20120801/src/cmd/ksh93/sh/macro.c.orig ksh-20120801/src/cmd/ksh93/sh/macro.c +--- ksh-20120801/src/cmd/ksh93/sh/macro.c.orig 2013-12-09 13:13:22.153525239 +0100 ++++ ksh-20120801/src/cmd/ksh93/sh/macro.c 2013-12-09 13:20:58.144635385 +0100 @@ -391,7 +391,7 @@ void sh_machere(Shell_t *shp,Sfio_t *inf break; } @@ -19,9 +19,24 @@ diff -up ksh-20120801/src/cmd/ksh93/sh/macro.c.fd2lost ksh-20120801/src/cmd/ksh9 return(1); case S_DIG: var = 0; -diff -up ksh-20120801/src/cmd/ksh93/sh/subshell.c.fd2lost ksh-20120801/src/cmd/ksh93/sh/subshell.c ---- ksh-20120801/src/cmd/ksh93/sh/subshell.c.fd2lost 2014-01-22 16:23:21.222658887 +0100 -+++ ksh-20120801/src/cmd/ksh93/sh/subshell.c 2014-01-22 16:23:21.243658703 +0100 +@@ -2152,10 +2152,12 @@ static void comsubst(Mac_t *mp,register + mp->ifsp = nv_getval(np); + stkset(stkp,savptr,savtop); + newlines = 0; +- if(type/*==3 - don't break `` vs $() */ && mp->shp->spid) ++ if(type==3 && mp->shp->spid) + { + job_wait(mp->shp->spid); +- mp->shp->spid = 0; ++ if(mp->shp->pipepid==mp->shp->spid) ++ mp->shp->spid = 0; ++ mp->shp->pipepid = 0; + } + sfsetbuf(sp,(void*)sp,0); + bufsize = sfvalue(sp); +diff -up ksh-20120801/src/cmd/ksh93/sh/subshell.c.anotherfix ksh-20120801/src/cmd/ksh93/sh/subshell.c +--- ksh-20120801/src/cmd/ksh93/sh/subshell.c.anotherfix 2014-01-20 14:43:46.410416327 +0100 ++++ ksh-20120801/src/cmd/ksh93/sh/subshell.c 2014-01-20 14:43:46.444416042 +0100 @@ -122,7 +122,8 @@ void sh_subtmpfile(Shell_t *shp) else if(errno!=EBADF) errormsg(SH_DICT,ERROR_system(1),e_toomany); @@ -32,33 +47,10 @@ diff -up ksh-20120801/src/cmd/ksh93/sh/subshell.c.fd2lost ksh-20120801/src/cmd/k if((fd=sffileno(sfstdout))<0) { /* unable to create the /tmp file so use a pipe */ -@@ -635,6 +636,13 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_ - } - else - { -+ if(comsub!=1 && shp->spid) -+ { -+ job_wait(shp->spid); -+ if(shp->pipepid==shp->spid) -+ shp->spid = 0; -+ shp->pipepid = 0; -+ } - /* move tmp file to iop and restore sfstdout */ - iop = sfswap(sfstdout,NIL(Sfio_t*)); - if(!iop) -diff -up ksh-20120801/src/cmd/ksh93/sh/xec.c.fd2lost ksh-20120801/src/cmd/ksh93/sh/xec.c ---- ksh-20120801/src/cmd/ksh93/sh/xec.c.fd2lost 2014-01-22 16:23:21.237658756 +0100 -+++ ksh-20120801/src/cmd/ksh93/sh/xec.c 2014-01-22 16:38:36.374666019 +0100 -@@ -1756,6 +1756,8 @@ int sh_exec(register const Shnode_t *t, - nlock--; - job_unlock(); - } -+ if(shp->subshell) -+ shp->spid = parent; - if(type&FPCL) - sh_close(shp->inpipe[0]); - if(type&(FCOOP|FAMP)) -@@ -1771,7 +1773,11 @@ int sh_exec(register const Shnode_t *t, +diff -up ksh-20120801/src/cmd/ksh93/sh/xec.c.anotherfix ksh-20120801/src/cmd/ksh93/sh/xec.c +--- ksh-20120801/src/cmd/ksh93/sh/xec.c.anotherfix 2014-01-20 14:47:30.527524008 +0100 ++++ ksh-20120801/src/cmd/ksh93/sh/xec.c 2014-01-20 14:47:30.563523703 +0100 +@@ -1773,7 +1773,11 @@ int sh_exec(register const Shnode_t *t, if(shp->pipepid) shp->pipepid = parent; else diff --git a/ksh-20120801-filecomsubst.patch b/ksh-20120801-filecomsubst.patch index 676cc27..6aa1fea 100644 --- a/ksh-20120801-filecomsubst.patch +++ b/ksh-20120801-filecomsubst.patch @@ -1,5 +1,5 @@ -diff -up ksh-20120801/src/cmd/ksh93/sh/io.c.tryfix01 ksh-20120801/src/cmd/ksh93/sh/io.c ---- ksh-20120801/src/cmd/ksh93/sh/io.c.tryfix01 2014-02-26 16:15:52.355391420 +0100 +diff -up ksh-20120801/src/cmd/ksh93/sh/io.c.filecombsubst ksh-20120801/src/cmd/ksh93/sh/io.c +--- ksh-20120801/src/cmd/ksh93/sh/io.c.filecombsubst 2014-02-26 16:15:52.355391420 +0100 +++ ksh-20120801/src/cmd/ksh93/sh/io.c 2014-02-26 16:23:55.588148801 +0100 @@ -1326,6 +1326,7 @@ int sh_redirect(Shell_t *shp,struct iono if(flag==SH_SHOWME) diff --git a/ksh-20120801-macro.patch b/ksh-20120801-macro.patch index 004a5eb..ca8024e 100644 --- a/ksh-20120801-macro.patch +++ b/ksh-20120801-macro.patch @@ -176,3 +176,30 @@ diff -up ksh-20120801/src/cmd/ksh93/sh/xec.c.macro ksh-20120801/src/cmd/ksh93/sh #if 0 nv_putval(SH_FUNNAMENOD,shp->st.funname,NV_NOFREE); #else +diff -up ksh-20120801/src/cmd/ksh93/sh/macro.c.orig ksh-20120801/src/cmd/ksh93/sh/macro.c +--- ksh-20120801/src/cmd/ksh93/sh/macro.c.orig 2012-06-29 20:05:47.000000000 +0200 ++++ ksh-20120801/src/cmd/ksh93/sh/macro.c 2013-08-12 18:06:17.291843164 +0200 +@@ -2152,6 +2152,11 @@ static void comsubst(Mac_t *mp,register + mp->ifsp = nv_getval(np); + stkset(stkp,savptr,savtop); + newlines = 0; ++ if(type/*==3 - don't break `` vs $() */ && mp->shp->spid) ++ { ++ job_wait(mp->shp->spid); ++ mp->shp->spid = 0; ++ } + sfsetbuf(sp,(void*)sp,0); + bufsize = sfvalue(sp); + /* read command substitution output and put on stack or here-doc */ +diff -up ksh-20120801/src/cmd/ksh93/sh/xec.c.orig ksh-20120801/src/cmd/ksh93/sh/xec.c +--- ksh-20120801/src/cmd/ksh93/sh/xec.c.orig 2013-08-12 18:06:57.567497226 +0200 ++++ ksh-20120801/src/cmd/ksh93/sh/xec.c 2013-08-12 18:20:36.443454280 +0200 +@@ -1734,6 +1734,8 @@ int sh_exec(register const Shnode_t *t, + nlock--; + job_unlock(); + } ++ if(shp->subshell) ++ shp->spid = parent; + if(type&FPCL) + sh_close(shp->inpipe[0]); + if(type&(FCOOP|FAMP)) diff --git a/ksh.spec b/ksh.spec index cceea53..875bb4d 100644 --- a/ksh.spec +++ b/ksh.spec @@ -9,7 +9,7 @@ Group: System Environment/Shells #CPL everywhere else (for KSH itself) License: CPL Version: %{releasedate} -Release: 23%{?dist} +Release: 24%{?dist} 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 Source2: kshcomp.conf @@ -68,58 +68,87 @@ Patch32: ksh-20100621-manfix3.patch # rhbz#1016611 Patch33: ksh-20120801-nomulti.patch -# for ksh <= 2014-01-14, rhbz# -Patch34: ksh-20120801-mtty.patch +# from upstream, rhbz#1036802 +Patch34: ksh-20120801-fd2lost.patch -# from upstream, rbzh#1048272 -Patch35: ksh-20120801-fd2lost.patch +# for ksh <= 2014-01-14, rhbz#1036470 +Patch35: ksh-20120801-memlik3.patch -# sent upstream 2014-01, rhbz#1047507 -Patch36: ksh-20120801-argvfix.patch +# for ksh <= 2014-03-04, rhbz#1066589 +Patch36: ksh-20120801-filecomsubst.patch -# for ksh <= 2014-01-14, rhbz#1048995 -Patch37: ksh-20120801-memlik3.patch +# for ksh <= 2014-04-05, rhbz#825520 +Patch37: ksh-20120801-crash.patch -# for ksh <= 2013-04-09, rhbz#960371 -Patch38: ksh-20120801-lexfix.patch +# for ksh < 2013-03-19, rhbz#1075635 +Patch38: ksh-20120801-sufix.patch + +# for ksh < 2014-03, rhbz#1047506 +Patch39: ksh-20120801-argvfix.patch + +# sent upstream, rhbz#1078698 +Patch40: ksh-20140301-fikspand.patch + +# for ksh < 2014-04-15, rhbz#1070350 +Patch41: ksh-20120801-roundit.patch + +# for ksh < 2014-04-15, rhbz#1036931 +Patch42: ksh-20120801-heresub.patch + +# not included upstream yet, rhbz#1062296 +Patch43: ksh-20140415-hokaido.patch + +# for ksh < 20121004, rhbz#1083713 +Patch44: ksh-20120801-tpstl.patch -# not yet upstream, for ksh <= 2014-02-26, rhbz#1070328 -Patch39: ksh-20120801-filecomsubst.patch +# for ksh <= 20120214, rhbz#1023109 +Patch45: ksh-20120801-mtty.patch -# for ksh <= 2014-06-25, rhbz#825520,rhbz#1084406 -Patch40: ksh-20120801-crash.patch +# sent upstream, rhbz#1019334 +Patch46: ksh-20120801-manfix4.patch -# for ksh < 2013-03-19, rhbz#1085385 -Patch41: ksh-20120801-sufix.patch +# not upstream yet, rhbz#1105138 +Patch47: ksh-20120801-fununset.patch -# sent upstream, rhbz#1099935 -Patch42: ksh-20140301-fikspand.patch +# not upstream yet, rhbz#1102627 +Patch48: ksh-20120801-cdfix3.patch -# for ksh < 2014-04-15, rhbz#1070871 -Patch43: ksh-20120801-roundit.patch +# sent upstream, rhbz#1112306 +Patch49: ksh-20120801-locking.patch -# for ksh < 2014-04-15, rhbz#1111120 -Patch44: ksh-20120801-heresub.patch +# for ksh <= 2013-06-13, rhbz#1133582 +Patch50: ksh-20130613-cdfix4.patch +Patch51: ksh-20120801-retfix.patch -# not included upstream yet, rhbz#1077090 -Patch45: ksh-20140415-hokaido.patch +# not upstream yet, rhbz#1147645 +Patch52: ksh-20120801-oldenvinit.patch -# for ksh < 2012-10-04, rhbz#1121960 -Patch46: ksh-20120801-tpstl.patch +# not upstream yet, rhbz#1160923 +Patch53: ksh-20120801-noexeccdfix.patch -# sent upstream, rhbz#1100215 -Patch47: ksh-20120801-manfix4.patch +# sent upstream, for ksh <= 2014-09-30, rhbz#1168611 +Patch54: ksh-20120801-cdfork.patch -# not upstream yet, rhbz#1100215 -Patch48: ksh-20120801-fununset.patch +# from upsteam, for ksh < 2012-10-04, rhbz#1173668 +Patch55: ksh-20120801-emptyarrayinit.patch -# for ksh < 2014-06-25, rhbz#1109893 -Patch49: ksh-20120801-cdfix3.patch +# not upstream yet, rhbz#1188377 +Patch56: ksh-20120801-xufix.patch -# sent upstream, rhbz#1116506 -Patch50: ksh-20120801-locking.patch -Patch51: ksh-20130613-cdfix4.patch -Patch52: ksh-20120801-xufix.patch +# sent upstream, for ksh <= 2015-02-10, rhbz#1189294 +Patch57: ksh-20120801-assoc-unset-leak.patch + +# sent upstream, for ksh <= 2014-12-18, rhbz#1176670 +Patch58: ksh-20120801-alarmifs.patch + +# not yet upstream, rhbz#1116072 +Patch59: ksh-20140929-safefd.patch + +# workaround, for ksh < 2013-05-24, rhbz#1117404 +Patch60: ksh-20120801-trapcom.patch + +# for ksh <= 2013-04-09, rhbz#960371 +Patch61: ksh-20120801-lexfix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Conflicts: pdksh @@ -158,25 +187,34 @@ with "sh" (the Bourne Shell). %patch31 -p1 -b .covsfix %patch32 -p1 -b .manfix3 %patch33 -p1 -b .nomulti -%patch34 -p1 -b .mtty -%patch35 -p1 -b .fd2lost -%patch36 -p1 -b .argvfix -%patch37 -p1 -b .memlik3 -%patch38 -p1 -b .lexfix -%patch39 -p1 -b .filecomsubst -%patch40 -p1 -b .crash -%patch41 -p1 -b .sufix -%patch42 -p1 -b .fikspand -%patch43 -p1 -b .roundit -%patch44 -p1 -b .heresub -%patch45 -p1 -b .hokaido -%patch46 -p1 -b .tpstl -%patch47 -p1 -b .manfix4 -%patch48 -p1 -b .fununset -%patch49 -p1 -b .cdfix3 -%patch50 -p1 -b .locking -%patch51 -p1 -b .cdfix4 -%patch52 -p1 -b .xufix +%patch34 -p1 -b .fd2lost +%patch35 -p1 -b .memlik3 +%patch36 -p1 -b .filecomsubst +%patch37 -p1 -b .crash +%patch38 -p1 -b .sufix +%patch39 -p1 -b .argvfix +%patch40 -p1 -b .fikspand +%patch41 -p1 -b .roundit +%patch42 -p1 -b .heresub +%patch43 -p1 -b .hokaido +%patch44 -p1 -b .tpstl +%patch45 -p1 -b .mtty +%patch46 -p1 -b .manfix4 +%patch47 -p1 -b .fununset +%patch48 -p1 -b .cdfix3 +%patch49 -p1 -b .locking +%patch50 -p1 -b .cdfix4 +%patch51 -p1 -b .retfix +%patch52 -p1 -b .oldenvinit +%patch53 -p1 -b .noexeccdfix +%patch54 -p1 -b .cdfork +%patch55 -p1 -b .emptyarrayinit +%patch56 -p1 -b .xufix +%patch57 -p1 -b .assoc-unset-leak +%patch58 -p1 -b .alarmifs +%patch59 -p1 -b .safefd +%patch60 -p1 -b .trapcom +%patch61 -p1 -b .lexfix #/dev/fd test does not work because of mock sed -i 's|ls /dev/fd|ls /proc/self/fd|' src/cmd/ksh93/features/options @@ -184,6 +222,9 @@ sed -i 's|ls /dev/fd|ls /proc/self/fd|' src/cmd/ksh93/features/options # sh/main.c was not using CCFLAGS sed -i '/-c sh\/main.c/s|${mam_cc_FLAGS} |${mam_cc_FLAGS} ${CCFLAGS} |p' src/cmd/ksh93/Mamfile +# disable register for debugging +sed -i 1i"#define register" src/lib/libast/include/ast.h + %build XTRAFLAGS="" for f in -Wno-unknown-pragmas -Wno-missing-braces -Wno-unused-result -Wno-return-type -Wno-int-to-pointer-cast -Wno-parentheses -Wno-unused -Wno-unused-but-set-variable -Wno-cpp -P @@ -277,6 +318,12 @@ fi rm -rf $RPM_BUILD_ROOT %changelog +* Mon Mar 30 2015 Michal Hlavinka - 20120801-24 +- cd builtin could break IO redirection +- fix segfault when handling a trap +- exporting fixed with variable corrupted its data +- and more fixes + * Fri Mar 06 2015 Michal Hlavinka - 20120801-23 - exporting fixed with variable corrupted its data (#1192027)