From f38fd168f2978ea8a7ce24213a9216e3196230dc Mon Sep 17 00:00:00 2001 From: CentOS Buildsys Date: Feb 26 2014 16:56:29 +0000 Subject: import ksh-20120801-19.el7.src.rpm --- diff --git a/SOURCES/ksh-20100621-manfix3.patch b/SOURCES/ksh-20100621-manfix3.patch new file mode 100644 index 0000000..bced575 --- /dev/null +++ b/SOURCES/ksh-20100621-manfix3.patch @@ -0,0 +1,12 @@ +diff -up ksh-20100621/src/cmd/ksh93/sh.1.manfix3 ksh-20100621/src/cmd/ksh93/sh.1 +--- ksh-20100621/src/cmd/ksh93/sh.1.manfix3 2013-05-02 13:07:51.180529762 +0200 ++++ ksh-20100621/src/cmd/ksh93/sh.1 2013-05-02 13:11:30.469327199 +0200 +@@ -7585,7 +7585,7 @@ file descriptor 2. + If the + .B \-i + option is present or +-if the shell input and output are attached to a terminal (as told by ++if the shell input and error output are attached to a terminal (as told by + .IR tcgetattr (2)), + then this shell is + .IR interactive . diff --git a/SOURCES/ksh-20120801-argvfix.patch b/SOURCES/ksh-20120801-argvfix.patch new file mode 100644 index 0000000..b0e1a78 --- /dev/null +++ b/SOURCES/ksh-20120801-argvfix.patch @@ -0,0 +1,13 @@ +diff -up ksh-20120801/src/cmd/ksh93/sh/main.c.fixargs ksh-20120801/src/cmd/ksh93/sh/main.c +--- ksh-20120801/src/cmd/ksh93/sh/main.c.fixargs 2013-12-31 11:32:14.917874134 +0100 ++++ ksh-20120801/src/cmd/ksh93/sh/main.c 2013-12-31 11:32:58.028847126 +0100 +@@ -757,7 +757,7 @@ static void fixargs(char **argv, int mod + offset += size; + buff[offset++] = ' '; + } +- buff[offset-1] = 0; ++ memset(&buff[offset - 1], 0, command_len - offset + 1); + # ifdef PSTAT + un.pst_command = stakptr(0); + pstat(PSTAT_SETCMD,un,0,0,0); + diff --git a/SOURCES/ksh-20120801-fd2lost.patch b/SOURCES/ksh-20120801-fd2lost.patch new file mode 100644 index 0000000..0605f6e --- /dev/null +++ b/SOURCES/ksh-20120801-fd2lost.patch @@ -0,0 +1,72 @@ +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 +@@ -391,7 +391,7 @@ void sh_machere(Shell_t *shp,Sfio_t *inf + break; + } + case S_PAR: +- comsubst(mp,(Shnode_t*)0,1); ++ comsubst(mp,(Shnode_t*)0,3); + break; + case S_EOF: + if((c=fcfill()) > 0) +@@ -1165,7 +1165,7 @@ retry1: + case S_PAR: + if(type) + goto nosub; +- comsubst(mp,(Shnode_t*)0,1); ++ comsubst(mp,(Shnode_t*)0,3); + 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 +@@ -122,7 +122,8 @@ void sh_subtmpfile(Shell_t *shp) + else if(errno!=EBADF) + errormsg(SH_DICT,ERROR_system(1),e_toomany); + /* popping a discipline forces a /tmp file create */ +- sfdisc(sfstdout,SF_POPDISC); ++ if(shp->comsub != 1) ++ sfdisc(sfstdout,SF_POPDISC); + 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, + if(shp->pipepid) + shp->pipepid = parent; + else ++ { + job_wait(parent); ++ if(parent==shp->spid) ++ shp->spid = 0; ++ } + if(shp->topfd > topfd) + sh_iorestore(shp,topfd,0); + if(usepipe && tsetio && subdup && unpipe) diff --git a/SOURCES/ksh-20120801-filecomsubst.patch b/SOURCES/ksh-20120801-filecomsubst.patch new file mode 100644 index 0000000..676cc27 --- /dev/null +++ b/SOURCES/ksh-20120801-filecomsubst.patch @@ -0,0 +1,11 @@ +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 ++++ 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) + goto traceit; + fd=sh_chkopen(fname); ++ fd=sh_iomovefd(fd); + } + else if(sh_isoption(SH_RESTRICTED)) + errormsg(SH_DICT,ERROR_exit(1),e_restricted,fname); diff --git a/SOURCES/ksh-20120801-kshmfix.patch b/SOURCES/ksh-20120801-kshmfix.patch index 72c792a..cc68406 100644 --- a/SOURCES/ksh-20120801-kshmfix.patch +++ b/SOURCES/ksh-20120801-kshmfix.patch @@ -51,3 +51,16 @@ diff -up ksh-20120801/src/cmd/ksh93/sh/xec.c.orig ksh-20120801/src/cmd/ksh93/sh/ tcsetpgrp(JOBTTY,shp->gd->pid); #endif /*SIGTSTP */ job.curpgid = savepgid; +diff -up ksh-20120801/src/cmd/ksh93/edit/edit.c.kshmfix ksh-20120801/src/cmd/ksh93/edit/edit.c +--- ksh-20120801/src/cmd/ksh93/edit/edit.c.kshmfix 2013-09-23 10:46:57.007256192 +0200 ++++ ksh-20120801/src/cmd/ksh93/edit/edit.c 2013-09-23 10:47:43.988937610 +0200 +@@ -1050,7 +1050,7 @@ int ed_getchar(register Edit_t *ep,int m + { + if(mode<=0 && -c == ep->e_intr) + { +- sh_fault(SIGINT); ++ killpg(getpgrp(),SIGINT); + siglongjmp(ep->e_env, UINTR); + } + if(mode<=0 && ep->sh->st.trap[SH_KEYTRAP]) + diff --git a/SOURCES/ksh-20120801-lexfix.patch b/SOURCES/ksh-20120801-lexfix.patch new file mode 100644 index 0000000..9150da8 --- /dev/null +++ b/SOURCES/ksh-20120801-lexfix.patch @@ -0,0 +1,56 @@ +diff -up ksh-20120801/src/cmd/ksh93/edit/edit.c.trajfiks ksh-20120801/src/cmd/ksh93/edit/edit.c +--- ksh-20120801/src/cmd/ksh93/edit/edit.c.trajfiks 2012-08-02 00:18:19.000000000 +0200 ++++ ksh-20120801/src/cmd/ksh93/edit/edit.c 2014-02-06 12:12:11.570942651 +0100 +@@ -53,6 +53,7 @@ + + static char CURSOR_UP[20] = { ESC, '[', 'A', 0 }; + static char KILL_LINE[20] = { ESC, '[', 'J', 0 }; ++static char *savelex; + + + +@@ -232,6 +233,8 @@ int tty_set(int fd, int action, struct t + void tty_cooked(register int fd) + { + register Edit_t *ep = (Edit_t*)(shgd->ed_context); ++ if(ep->sh->st.trap[SH_KEYTRAP] && savelex) ++ memcpy(ep->sh->lex_context,savelex,ep->sh->lexsize); + ep->e_keytrap = 0; + if(ep->e_raw==0) + return; +@@ -783,6 +786,13 @@ void ed_setup(register Edit_t *ep, int f + ep->e_lbuf[n] = *pp++; + ep->e_default = 0; + } ++ if(ep->sh->st.trap[SH_KEYTRAP]) ++ { ++ if(!savelex) ++ savelex = (char*)malloc(shp->lexsize); ++ if(savelex) ++ memcpy(savelex, ep->sh->lex_context, ep->sh->lexsize); ++ } + } + + static void ed_putstring(register Edit_t *ep, const char *str) +diff -up ksh-20120801/src/cmd/ksh93/include/defs.h.trajfiks ksh-20120801/src/cmd/ksh93/include/defs.h +--- ksh-20120801/src/cmd/ksh93/include/defs.h.trajfiks 2014-02-06 12:18:13.149091836 +0100 ++++ ksh-20120801/src/cmd/ksh93/include/defs.h 2014-02-06 12:18:13.175091784 +0100 +@@ -224,6 +224,7 @@ struct shared + int xargexit; \ + int nenv; \ + mode_t mask; \ ++ int lexsize; \ + Env_t *env; \ + void *init_context; \ + void *mac_context; \ +diff -up ksh-20120801/src/cmd/ksh93/sh/lex.c.trajfiks ksh-20120801/src/cmd/ksh93/sh/lex.c +--- ksh-20120801/src/cmd/ksh93/sh/lex.c.trajfiks 2014-02-06 12:19:13.587950320 +0100 ++++ ksh-20120801/src/cmd/ksh93/sh/lex.c 2014-02-06 12:19:13.623950219 +0100 +@@ -268,6 +268,7 @@ Lex_t *sh_lexopen(Lex_t *lp, Shell_t *sp + { + lp = (Lex_t*)newof(0,Lex_t,1,0); + lp->sh = sp; ++ sp->lexsize = sizeof(Lex_t); + } + fcnotify(lex_advance,lp); + lp->lex.intest = lp->lex.incase = lp->lex.skipword = lp->lexd.warn = 0; diff --git a/SOURCES/ksh-20120801-memlik3.patch b/SOURCES/ksh-20120801-memlik3.patch new file mode 100644 index 0000000..9df57d2 --- /dev/null +++ b/SOURCES/ksh-20120801-memlik3.patch @@ -0,0 +1,76 @@ +diff -up ksh-20120801/src/cmd/ksh93/include/name.h.memlik3 ksh-20120801/src/cmd/ksh93/include/name.h +--- ksh-20120801/src/cmd/ksh93/include/name.h.memlik3 2012-05-10 18:33:41.000000000 +0200 ++++ ksh-20120801/src/cmd/ksh93/include/name.h 2014-01-22 14:14:32.774483776 +0100 +@@ -215,7 +215,7 @@ extern Namval_t *nv_mount(Namval_t*, co + extern Namval_t *nv_arraychild(Namval_t*, Namval_t*, int); + extern int nv_compare(Dt_t*, Void_t*, Void_t*, Dtdisc_t*); + extern void nv_outnode(Namval_t*,Sfio_t*, int, int); +-extern int nv_subsaved(Namval_t*); ++extern int nv_subsaved(Namval_t*,int); + extern void nv_typename(Namval_t*, Sfio_t*); + extern void nv_newtype(Namval_t*); + extern int nv_istable(Namval_t*); +diff -up ksh-20120801/src/cmd/ksh93/sh/name.c.memlik3 ksh-20120801/src/cmd/ksh93/sh/name.c +--- ksh-20120801/src/cmd/ksh93/sh/name.c.memlik3 2014-01-22 14:14:32.751483987 +0100 ++++ ksh-20120801/src/cmd/ksh93/sh/name.c 2014-01-22 14:14:32.775483767 +0100 +@@ -1297,7 +1297,7 @@ void nv_delete(Namval_t* np, Dt_t *root, + { + if(dtdelete(root,np)) + { +- if(!(flags&NV_NOFREE) && ((flags&NV_FUNCTION) || !nv_subsaved(np))) ++ if(!(flags&NV_NOFREE) && ((flags&NV_FUNCTION) || !nv_subsaved(np,flags&NV_TABLE))) + free((void*)np); + } + #if 0 +@@ -2461,14 +2461,14 @@ static void table_unset(Shell_t *shp, re + { + _nv_unset(nq,flags); + npnext = (Namval_t*)dtnext(root,nq); +- nv_delete(nq,root,0); ++ nv_delete(nq,root,NV_TABLE); + } + } + npnext = (Namval_t*)dtnext(root,np); + if(nv_arrayptr(np)) + nv_putsub(np,NIL(char*),ARRAY_SCAN); + _nv_unset(np,flags); +- nv_delete(np,root,0); ++ nv_delete(np,root,NV_TABLE); + } + } + +diff -up ksh-20120801/src/cmd/ksh93/sh/subshell.c.memlik3 ksh-20120801/src/cmd/ksh93/sh/subshell.c +--- ksh-20120801/src/cmd/ksh93/sh/subshell.c.memlik3 2014-01-22 14:14:32.768483831 +0100 ++++ ksh-20120801/src/cmd/ksh93/sh/subshell.c 2014-01-22 14:20:50.810236676 +0100 +@@ -218,16 +218,28 @@ void sh_subfork(void) + } + } + +-int nv_subsaved(register Namval_t *np) ++int nv_subsaved(register Namval_t *np,int table) + { + register struct subshell *sp; +- register struct Link *lp; ++ register struct Link *lp, *lpprev; + for(sp = (struct subshell*)subshell_data; sp; sp=sp->prev) + { +- for(lp=sp->svar; lp; lp = lp->next) ++ lpprev = 0; ++ for(lp=sp->svar; lp; lpprev=lp, lp=lp->next) + { + if(lp->node==np) ++ { ++ if(table&NV_TABLE) ++ { ++ if(lpprev) ++ lpprev->next = lp->next; ++ else ++ sp->svar = lp->next; ++ free((void*)np); ++ free((void*)lp); ++ } + return(1); ++ } + } + } + return(0); diff --git a/SOURCES/ksh-20120801-mtty.patch b/SOURCES/ksh-20120801-mtty.patch index 7f599e6..d992a88 100644 --- a/SOURCES/ksh-20120801-mtty.patch +++ b/SOURCES/ksh-20120801-mtty.patch @@ -1,12 +1,12 @@ diff -up ksh-20120801/src/cmd/ksh93/sh/xec.c.mtty ksh-20120801/src/cmd/ksh93/sh/xec.c ---- ksh-20120801/src/cmd/ksh93/sh/xec.c.mtty 2013-10-30 13:23:31.342298357 +0100 -+++ ksh-20120801/src/cmd/ksh93/sh/xec.c 2013-10-30 13:24:20.453885803 +0100 -@@ -3144,7 +3144,7 @@ pid_t _sh_fork(Shell_t *shp,register pid +--- ksh-20120801/src/cmd/ksh93/sh/xec.c.mtty 2014-01-22 16:52:06.441608750 +0100 ++++ ksh-20120801/src/cmd/ksh93/sh/xec.c 2014-01-22 16:52:06.485608361 +0100 +@@ -3163,7 +3169,7 @@ pid_t _sh_fork(Shell_t *shp,register pid * completed. Make parent the job group id. */ if(postid==0) - job.curpgid = parent; -+ job.curpgid = getpid(); ++ job.curpgid = job.jobcontrol?parent:getpid(); if(job.jobcontrol || (flags&FAMP)) { if(setpgid(parent,job.curpgid)<0 && errno==EPERM) diff --git a/SOURCES/ksh-20120801-nomulti.patch b/SOURCES/ksh-20120801-nomulti.patch new file mode 100644 index 0000000..5d7e7a4 --- /dev/null +++ b/SOURCES/ksh-20120801-nomulti.patch @@ -0,0 +1,11 @@ +diff -up ksh-20120801/src/cmd/ksh93/sh/init.c.nomulti ksh-20120801/src/cmd/ksh93/sh/init.c +--- ksh-20120801/src/cmd/ksh93/sh/init.c.nomulti 2013-10-08 20:46:46.202471042 +0200 ++++ ksh-20120801/src/cmd/ksh93/sh/init.c 2013-10-08 20:46:57.912331483 +0200 +@@ -1446,7 +1446,6 @@ Shell_t *sh_init(register int argc,regis + #endif /* SHOPT_TIMEOUT */ + /* initialize jobs table */ + job_clear(); +- sh_onoption(SH_MULTILINE); + if(argc>0) + { + /* check for restricted shell */ diff --git a/SPECS/ksh.spec b/SPECS/ksh.spec index f8a2cb3..4a05dbe 100644 --- a/SPECS/ksh.spec +++ b/SPECS/ksh.spec @@ -8,7 +8,7 @@ Group: System Environment/Shells #CPL everywhere else (for KSH itself) License: EPL Version: 20120801 -Release: 11%{?dist} +Release: 19%{?dist} Source0: http://www.research.att.com/~gsf/download/tgz/ast-ksh.%{releasedate}.tgz Source1: http://www.research.att.com/~gsf/download/tgz/INIT.%{releasedate}.tgz Source2: kshcomp.conf @@ -60,7 +60,30 @@ Patch30: ksh-20120801-mlikfiks.patch # not yet upstream, related to 2012-08-01 rebase Patch31: ksh-20120801-covsfix.patch -Patch100: ksh-20120801-mtty.patch + +# rhbz#1007816 +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, rbzh#1048272 +Patch35: ksh-20120801-fd2lost.patch + +# sent upstream 2014-01, rhbz#1047507 +Patch36: ksh-20120801-argvfix.patch + +# for ksh <= 2014-01-14, rhbz#1048995 +Patch37: ksh-20120801-memlik3.patch + +# for ksh <= 2013-04-09, rhbz#960371 +Patch38: ksh-20120801-lexfix.patch + +# not yet upstream, for ksh <= 2014-02-26, rhbz#1070328 +Patch39: ksh-20120801-filecomsubst.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Conflicts: pdksh @@ -96,7 +119,14 @@ with "sh" (the Bourne Shell). %patch29 -p1 -b .longer %patch30 -p1 -b .mlikfiks %patch31 -p1 -b .covsfix -%patch100 -p1 -b .mtty +%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 #/dev/fd test does not work because of mock sed -i 's|ls /dev/fd|ls /proc/self/fd|' src/cmd/ksh93/features/options @@ -213,6 +243,35 @@ fi rm -rf $RPM_BUILD_ROOT %changelog +* Wed Feb 26 2014 Michal Hlavinka - 20120801-19 +- reading a file via command substitution did not work when any of stdin, + stdout or stderr were closed (#1070328) + +* Tue Feb 11 2014 Michal Hlavinka - 20120801-18 +- fix lexical parser crash (#1062220) + +* Thu Jan 30 2014 Michal Hlavinka - 20120801-17 +- add missing patch and rebuild (#1048995) + +* Fri Jan 24 2014 Daniel Mach - 20120801-16 +- Mass rebuild 2014-01-24 + +* Wed Jan 22 2014 Michal Hlavinka - 20120801-15 +- fix argv rewrite (#1047507) +- fix memory leak (#1048995) +- standard error output could get misdirected (#1048272) + +* Fri Jan 03 2014 Michal Hlavinka - 20120801-14 +- fix interactive mode hangs (#1034909) + +* Fri Dec 27 2013 Daniel Mach - 20120801-13 +- Mass rebuild 2013-12-27 + +* Tue Nov 26 2013 Michal Hlavinka - 20120801-12 +- ksh sometimes wrote wrong byte sequence to terminal when vi editing + mode was used (#1026360) +- fix errors in man page (#1030867) + * Wed Oct 30 2013 Michal Hlavinka - 20120801-11 - ksh stops on read when monitor mode is enabled (#1023110)