From 5a79adef2d86e5b36801b8cd4277fb144831f4dd Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 05 2015 13:06:48 +0000 Subject: import ksh-20120801-22.el7 --- diff --git a/SOURCES/ksh-20120801-cdfix3.patch b/SOURCES/ksh-20120801-cdfix3.patch new file mode 100644 index 0000000..7e47f71 --- /dev/null +++ b/SOURCES/ksh-20120801-cdfix3.patch @@ -0,0 +1,12 @@ +diff -up ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c.cdfix3 ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c +--- ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c.cdfix3 2014-06-20 12:39:02.757407689 +0200 ++++ ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c 2014-06-20 12:40:19.530998070 +0200 +@@ -290,7 +290,7 @@ int b_cd(int argc, char *argv[],Shbltin_ + if(newdirfd >=0) + { + /* chdir for directories on HSM/tapeworms may take minutes */ +- if(fchdir(newdirfd) >= 0) ++ if((rval=fchdir(newdirfd)) >= 0) + { + if(shp->pwdfd >= 0) + sh_close(shp->pwdfd); diff --git a/SOURCES/ksh-20120801-cdfork.patch b/SOURCES/ksh-20120801-cdfork.patch new file mode 100644 index 0000000..19ea1d5 --- /dev/null +++ b/SOURCES/ksh-20120801-cdfork.patch @@ -0,0 +1,38 @@ +--- ksh-20120801/src/cmd/ksh93/sh/path.c 2014-09-01 15:08:06.738969962 -0300 ++++ ksh-20120801/src/cmd/ksh93/sh/path.c 2014-09-01 15:13:51.321459978 -0300 +@@ -229,13 +229,12 @@ static pid_t path_xargs(Shell_t *shp,con + /* + * make sure PWD is set up correctly + * Return the present working directory +- * Invokes getcwd() if flag==0 and if necessary ++ * Invokes getcwd() if necessary + * Sets the PWD variable to this value + */ + char *path_pwd(Shell_t *shp,int flag) + { + register char *cp; +- register char *dfault = (char*)e_dot; + register int count = 0; + if(shp->pwd) + return((char*)shp->pwd); +@@ -254,11 +253,6 @@ char *path_pwd(Shell_t *shp,int flag) + cp = "/"; + break; + case 3: +- cp = (char*)e_crondir; +- if(flag) /* skip next case when non-zero flag */ +- ++count; +- break; +- case 4: + { + if(cp=getcwd(NIL(char*),0)) + { +@@ -269,8 +263,6 @@ char *path_pwd(Shell_t *shp,int flag) + } + break; + } +- case 5: +- return(dfault); + } + if(cp && *cp=='/' && test_inode(cp,e_dot)) + break; diff --git a/SOURCES/ksh-20120801-crash.patch b/SOURCES/ksh-20120801-crash.patch new file mode 100644 index 0000000..37b7962 --- /dev/null +++ b/SOURCES/ksh-20120801-crash.patch @@ -0,0 +1,64 @@ +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 +@@ -118,6 +118,7 @@ struct jobs + char jobcontrol; /* turned on for real job control */ + char waitsafe; /* wait will not block */ + char waitall; /* wait for all jobs in pipe */ ++ char hack1_waitall; + char toclear; /* job table needs clearing */ + 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 +@@ -1957,6 +1957,7 @@ again: + { + count = bp->count; + jp = bp->list; ++ jpold = 0; + goto again; + } + 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 +@@ -492,6 +492,7 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_ + struct sh_scoped savst; + struct dolnod *argsav=0; + int argcnt; ++ int pipefail = 0; + memset((char*)sp, 0, sizeof(*sp)); + sfsync(shp->outpool); + sh_sigcheck(shp); +@@ -541,7 +542,10 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_ + sp->comsub = shp->comsub; + shp->subshare = comsub==2 || (comsub==1 && sh_isoption(SH_SUBSHARE)); + if(comsub) ++ { + shp->comsub = comsub; ++ job.hack1_waitall=(comsub==1); ++ } + sp->shpwdfd=-1; + if(!comsub || !shp->subshare) + { +@@ -648,6 +652,7 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_ + } + else + { ++ job.hack1_waitall=0; + if(comsub!=1 && shp->spid) + { + job_wait(shp->spid); +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 +@@ -2125,7 +2125,7 @@ int sh_exec(register const Shnode_t *t, + memset(exitval,0,job.waitall*sizeof(int)); + } + else +- job.waitall |= !pipejob && sh_isstate(SH_MONITOR); ++ job.waitall |= job.hack1_waitall || !pipejob && sh_isstate(SH_MONITOR); + job_lock(); + nlock++; + do diff --git a/SOURCES/ksh-20120801-fununset.patch b/SOURCES/ksh-20120801-fununset.patch new file mode 100644 index 0000000..1f5cb17 --- /dev/null +++ b/SOURCES/ksh-20120801-fununset.patch @@ -0,0 +1,12 @@ +diff -up ksh-20120801/src/cmd/ksh93/sh/xec.c.fununset ksh-20120801/src/cmd/ksh93/sh/xec.c +--- ksh-20120801/src/cmd/ksh93/sh/xec.c.fununset 2014-06-16 14:21:09.293513844 +0200 ++++ ksh-20120801/src/cmd/ksh93/sh/xec.c 2014-06-16 14:21:09.309513760 +0200 +@@ -3570,7 +3570,7 @@ static void sh_funct(Shell_t *shp,Namval + #endif + nv_putval(SH_PATHNAMENOD,shp->st.filename,NV_NOFREE); + shp->pipepid = pipepid; +- np->nvalue.rp->running -= 2; ++ if (np->nvalue.rp) np->nvalue.rp->running -= 2; + } + + /* diff --git a/SOURCES/ksh-20120801-heresub.patch b/SOURCES/ksh-20120801-heresub.patch new file mode 100644 index 0000000..880071c --- /dev/null +++ b/SOURCES/ksh-20120801-heresub.patch @@ -0,0 +1,32 @@ +diff -up ksh-20120801/src/cmd/ksh93/sh/lex.c.heresub ksh-20120801/src/cmd/ksh93/sh/lex.c +--- ksh-20120801/src/cmd/ksh93/sh/lex.c.heresub 2014-05-21 16:48:42.635700984 +0200 ++++ ksh-20120801/src/cmd/ksh93/sh/lex.c 2014-05-21 16:48:42.678700772 +0200 +@@ -1557,6 +1557,7 @@ static int comsub(register Lex_t *lp, in + { + register int n,c,count=1; + register int line=lp->sh->inlineno; ++ struct ionod *inheredoc = lp->heredoc; + char *first,*cp=fcseek(0),word[5]; + int off, messages=0, assignok=lp->assignok, csub; + struct lexstate save; +@@ -1683,7 +1684,7 @@ done: + lp->lexd.dolparen--; + lp->lex = save; + lp->assignok = (endchar(lp)==RBRACT?assignok:0); +- if(lp->heredoc) ++ if(lp->heredoc && !inheredoc) + errormsg(SH_DICT,ERROR_exit(SYNBAD),e_lexsyntax5,lp->sh->inlineno,lp->heredoc->ioname); + return(messages); + } +diff -up ksh-20120801/src/cmd/ksh93/sh/macro.c.heresub ksh-20120801/src/cmd/ksh93/sh/macro.c +--- ksh-20120801/src/cmd/ksh93/sh/macro.c.heresub 2014-05-21 16:48:42.650700910 +0200 ++++ ksh-20120801/src/cmd/ksh93/sh/macro.c 2014-05-21 16:48:42.678700772 +0200 +@@ -2085,7 +2085,7 @@ static void comsubst(Mac_t *mp,register + } + sfputc(stkp,c); + } +- sfputc(stkp,' '); ++ sfputc(stkp,'\n'); + c = stktell(stkp); + str=stkfreeze(stkp,1); + /* disable verbose and don't save in history file */ diff --git a/SOURCES/ksh-20120801-locking.patch b/SOURCES/ksh-20120801-locking.patch new file mode 100644 index 0000000..189d254 --- /dev/null +++ b/SOURCES/ksh-20120801-locking.patch @@ -0,0 +1,26 @@ +diff -up ksh-20120801/src/cmd/ksh93/include/jobs.h.locking ksh-20120801/src/cmd/ksh93/include/jobs.h +--- ksh-20120801/src/cmd/ksh93/include/jobs.h.locking 2014-06-27 15:51:07.144923719 +0200 ++++ ksh-20120801/src/cmd/ksh93/include/jobs.h 2014-06-27 15:52:56.463272276 +0200 +@@ -149,15 +149,18 @@ extern struct jobs job; + #define vmbusy() 0 + #endif + +-#define job_lock() (job.in_critical++) ++#define asoincint(p) __sync_fetch_and_add(p,1) ++#define asodecint(p) __sync_fetch_and_sub(p,1) ++ ++#define job_lock() asoincint(&job.in_critical) + #define job_unlock() \ + do { \ + int sig; \ +- if (!--job.in_critical && (sig = job.savesig)) \ ++ if (asodecint(&job.in_critical)==1 && (sig = job.savesig)) \ + { \ +- if (!job.in_critical++ && !vmbusy()) \ ++ if (!asoincint(&job.in_critical) && !vmbusy()) \ + job_reap(sig); \ +- job.in_critical--; \ ++ asodecint(&job.in_critical); \ + } \ + } while(0) + diff --git a/SOURCES/ksh-20120801-manfix4.patch b/SOURCES/ksh-20120801-manfix4.patch new file mode 100644 index 0000000..6355445 --- /dev/null +++ b/SOURCES/ksh-20120801-manfix4.patch @@ -0,0 +1,12 @@ +diff -up ksh-20120801/src/cmd/ksh93/sh.1.manfix4 ksh-20120801/src/cmd/ksh93/sh.1 +--- ksh-20120801/src/cmd/ksh93/sh.1.manfix4 2014-05-22 12:04:51.593750721 +0200 ++++ ksh-20120801/src/cmd/ksh93/sh.1 2014-05-22 12:05:32.561556452 +0200 +@@ -4147,7 +4147,7 @@ command are ignored if the command is fo + .B & + and the + .B monitor +-option is not active. ++option is active. + Otherwise, signals have the values + inherited by the shell from its parent + (but see also diff --git a/SOURCES/ksh-20120801-retfix.patch b/SOURCES/ksh-20120801-retfix.patch new file mode 100644 index 0000000..5af1053 --- /dev/null +++ b/SOURCES/ksh-20120801-retfix.patch @@ -0,0 +1,14 @@ +diff -up ksh-20120801/src/cmd/ksh93/sh/subshell.c.retfix ksh-20120801/src/cmd/ksh93/sh/subshell.c +--- ksh-20120801/src/cmd/ksh93/sh/subshell.c.retfix 2014-10-01 17:34:47.720532950 +0200 ++++ ksh-20120801/src/cmd/ksh93/sh/subshell.c 2014-10-01 17:35:25.850350378 +0200 +@@ -655,7 +655,10 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_ + job.hack1_waitall=0; + if(comsub!=1 && shp->spid) + { ++ int c = shp->exitval; + job_wait(shp->spid); ++ shp->exitval = c; ++ exitset(); + if(shp->pipepid==shp->spid) + shp->spid = 0; + shp->pipepid = 0; diff --git a/SOURCES/ksh-20120801-roundit.patch b/SOURCES/ksh-20120801-roundit.patch new file mode 100644 index 0000000..015bc85 --- /dev/null +++ b/SOURCES/ksh-20120801-roundit.patch @@ -0,0 +1,12 @@ +diff -up ksh-20120801/src/lib/libast/sfio/sfcvt.c.rounditgood ksh-20120801/src/lib/libast/sfio/sfcvt.c +--- ksh-20120801/src/lib/libast/sfio/sfcvt.c.rounditgood 2014-02-27 16:45:54.630161032 +0100 ++++ ksh-20120801/src/lib/libast/sfio/sfcvt.c 2014-02-27 16:45:54.658161205 +0100 +@@ -491,7 +491,7 @@ int format; /* conversion format */ + *decpt += 1; + if(!(format&SFFMT_EFORMAT)) + { /* add one more 0 for %f precision */ +- ep[-1] = '0'; ++ if(ep-sp>1) ep[-1] = '0'; + ep += 1; + } + } diff --git a/SOURCES/ksh-20120801-sufix.patch b/SOURCES/ksh-20120801-sufix.patch new file mode 100644 index 0000000..b820e1c --- /dev/null +++ b/SOURCES/ksh-20120801-sufix.patch @@ -0,0 +1,11 @@ +diff -up ksh-20120801/src/cmd/ksh93/sh/io.c.sufix ksh-20120801/src/cmd/ksh93/sh/io.c +--- ksh-20120801/src/cmd/ksh93/sh/io.c.sufix 2014-04-08 14:30:14.412343555 +0200 ++++ ksh-20120801/src/cmd/ksh93/sh/io.c 2014-04-08 14:31:18.403876587 +0200 +@@ -2144,6 +2144,7 @@ static int io_prompt(Shell_t *shp,Sfio_t + } + #endif /* TIOCLBIC */ + cp = sh_mactry(shp,nv_getval(sh_scoped(shp,PS1NOD))); ++ shp->exitval = 0; + for(;c= *cp;cp++) + { + if(c==HIST_CHAR) diff --git a/SOURCES/ksh-20120801-tpstl.patch b/SOURCES/ksh-20120801-tpstl.patch new file mode 100644 index 0000000..41e17c8 --- /dev/null +++ b/SOURCES/ksh-20120801-tpstl.patch @@ -0,0 +1,12 @@ +diff -up ksh-20120801/src/cmd/ksh93/sh/init.c.tpstl ksh-20120801/src/cmd/ksh93/sh/init.c +--- ksh-20120801/src/cmd/ksh93/sh/init.c.tpstl 2014-04-03 11:21:25.395547276 +0200 ++++ ksh-20120801/src/cmd/ksh93/sh/init.c 2014-04-03 11:26:03.908867208 +0200 +@@ -332,7 +332,7 @@ static Namfun_t *clone_optindex(Namval_t + /* Trap for restricted variables FPATH, PATH, SHELL, ENV */ + static void put_restricted(register Namval_t* np,const char *val,int flags,Namfun_t *fp) + { +- Shell_t *shp = nv_shell(np); ++ Shell_t *shp = sh_getinterp(); + int path_scoped = 0, fpath_scoped=0; + Pathcomp_t *pp; + char *name = nv_name(np); diff --git a/SOURCES/ksh-20130613-cdfix4.patch b/SOURCES/ksh-20130613-cdfix4.patch new file mode 100644 index 0000000..5b29017 --- /dev/null +++ b/SOURCES/ksh-20130613-cdfix4.patch @@ -0,0 +1,15 @@ +diff -up ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c.cdfix4 ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c +--- ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c.cdfix4 2014-08-26 15:24:57.276953822 +0200 ++++ ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c 2014-08-26 15:25:34.738770361 +0200 +@@ -143,9 +143,9 @@ int sh_diropenat(Shell_t *shp, int dir, + } + + /* Move fd to a number > 10 and *register* the fd number with the shell */ +- shfd = sh_fcntl(fd, F_dupfd_cloexec, 10); ++ shfd = fcntl(fd, F_dupfd_cloexec, 10); + savederrno=errno; +- sh_close(fd); ++ close(fd); + errno=savederrno; + return(shfd); + } diff --git a/SOURCES/ksh-20140301-fikspand.patch b/SOURCES/ksh-20140301-fikspand.patch new file mode 100644 index 0000000..9899392 --- /dev/null +++ b/SOURCES/ksh-20140301-fikspand.patch @@ -0,0 +1,12 @@ +diff -up ksh-20120801/src/cmd/ksh93/sh/expand.c.fikspand ksh-20120801/src/cmd/ksh93/sh/expand.c +--- ksh-20120801/src/cmd/ksh93/sh/expand.c.fikspand 2010-11-24 05:46:30.000000000 +0100 ++++ ksh-20120801/src/cmd/ksh93/sh/expand.c 2014-05-22 12:55:46.252717371 +0200 +@@ -278,6 +278,8 @@ int path_generate(Shell_t *shp,struct ar + char comma, range=0; + int first, last, incr, count = 0; + char tmp[32], end[1]; ++ if(!sh_isoption(SH_BRACEEXPAND)) ++ return path_expand(shp,todo->argval,arghead); + todo->argchn.ap = 0; + again: + apin = ap = todo; diff --git a/SOURCES/ksh-20140415-hokaido.patch b/SOURCES/ksh-20140415-hokaido.patch new file mode 100644 index 0000000..5ff6927 --- /dev/null +++ b/SOURCES/ksh-20140415-hokaido.patch @@ -0,0 +1,37 @@ +diff -up ksh-20120801/src/cmd/ksh93/sh/xec.c.hokaido ksh-20120801/src/cmd/ksh93/sh/xec.c +--- ksh-20120801/src/cmd/ksh93/sh/xec.c.hokaido 2014-09-18 14:41:57.696756230 +0200 ++++ ksh-20120801/src/cmd/ksh93/sh/xec.c 2014-09-18 14:43:55.439205247 +0200 +@@ -1633,12 +1633,20 @@ int sh_exec(register const Shnode_t *t, + #endif /* SHOPT_COSHELL */ + if(shp->subshell) + { ++ int comsubsave = shp->comsub; ++ if(comsubsave==1) ++ shp->comsub = 2; + sh_subtmpfile(shp); ++ shp->comsub = comsubsave; ++ if(shp->comsub==1 && (!(shp->fdstatus[1]&IONOSEEK))) ++ unpipe = iousepipe(shp); ++ + if((type&(FAMP|TFORK))==(FAMP|TFORK)) + { + if(shp->comsub && !(shp->fdstatus[1]&IONOSEEK)) + { +- unpipe = iousepipe(shp); ++ if (!unpipe) ++ unpipe = iousepipe(shp); + sh_subfork(); + } + } +@@ -2107,7 +2115,11 @@ int sh_exec(register const Shnode_t *t, + job.curjobid = 0; + if(shp->subshell) + { ++ int comsubsave = shp->comsub; ++ if(comsubsave==1) ++ shp->comsub = 2; + sh_subtmpfile(shp); ++ shp->comsub = comsubsave; + if(shp->comsub==1 && !(shp->fdstatus[1]&IONOSEEK)) + iousepipe(shp); + } diff --git a/SPECS/ksh.spec b/SPECS/ksh.spec index 4a05dbe..c2eb715 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: 19%{?dist} +Release: 22%{?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 @@ -85,6 +85,47 @@ Patch38: ksh-20120801-lexfix.patch # not yet upstream, for ksh <= 2014-02-26, rhbz#1070328 Patch39: ksh-20120801-filecomsubst.patch +# for ksh <= 2014-06-25, rhbz#825520,rhbz#1084406 +Patch40: ksh-20120801-crash.patch + +# for ksh < 2013-03-19, rhbz#1085385 +Patch41: ksh-20120801-sufix.patch + +# sent upstream, rhbz#1099935 +Patch42: ksh-20140301-fikspand.patch + +# for ksh < 2014-04-15, rhbz#1070871 +Patch43: ksh-20120801-roundit.patch + +# for ksh < 2014-04-15, rhbz#1111120 +Patch44: ksh-20120801-heresub.patch + +# not included upstream yet, rhbz#1077090 +Patch45: ksh-20140415-hokaido.patch + +# for ksh < 2012-10-04, rhbz#1121960 +Patch46: ksh-20120801-tpstl.patch + +# sent upstream, rhbz#1100215 +Patch47: ksh-20120801-manfix4.patch + +# not upstream yet, rhbz#1100215 +Patch48: ksh-20120801-fununset.patch + +# for ksh < 2014-06-25, rhbz#1109893 +Patch49: ksh-20120801-cdfix3.patch + +# sent upstream, rhbz#1116506 +Patch50: ksh-20120801-locking.patch + +# for ksh <= 2013-06-13, rhbz#1133585 +Patch51: ksh-20130613-cdfix4.patch + +Patch52: ksh-20120801-retfix.patch + +# sent upstream, for ksh <= 2014-09-30 +Patch53: ksh-20120801-cdfork.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Conflicts: pdksh Requires: coreutils, diffutils, chkconfig @@ -127,6 +168,20 @@ with "sh" (the Bourne Shell). %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 .retfix +%patch53 -p1 -b .cdfork #/dev/fd test does not work because of mock sed -i 's|ls /dev/fd|ls /proc/self/fd|' src/cmd/ksh93/features/options @@ -136,7 +191,7 @@ sed -i '/-c sh\/main.c/s|${mam_cc_FLAGS} |${mam_cc_FLAGS} ${CCFLAGS} |p' src/cmd %build XTRAFLAGS="" -for f in -Wmissing-braces -Wunused-result -Wreturn-type -Wint-to-pointer-cast -Wno-parentheses -Wno-unused -Wno-unused-but-set-variable -Wno-cpp +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 do gcc $f -E - /dev/null 2>&1 && XTRAFLAGS="$XTRAFLAGS $f" done @@ -145,7 +200,7 @@ done ./bin/package make mamake ||: export CCFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing $XTRAFLAGS -DSHOPT_AUDIT" export CC=gcc -./bin/package "make" +./bin/package make -S %install @@ -159,6 +214,8 @@ install -m 644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/skel/.kshrc install -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/kshrc install -D -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/binfmt.d/kshcomp.conf +ln -s /bin/ksh93 $RPM_BUILD_ROOT/bin/rksh + #fool rpmbuild about %ghost files touch $RPM_BUILD_ROOT/bin/ksh touch $RPM_BUILD_ROOT%{_mandir}/man1/ksh.1.gz @@ -184,13 +241,16 @@ ls core.* 2>/dev/null ||: exit 0 %post -if [ ! -f /etc/shells ]; then - echo "/bin/ksh" > /etc/shells -else - if ! grep -q '^/bin/ksh$' /etc/shells ; then - echo "/bin/ksh" >> /etc/shells +for s in /bin/ksh /bin/rksh +do + if [ ! -f /etc/shells ]; then + echo "$s" > /etc/shells + else + if ! grep -q '^'"$s"'$' /etc/shells ; then + echo "$s" >> /etc/shells fi -fi + fi +done /bin/systemctl try-restart systemd-binfmt.service >/dev/null 2>&1 || : %{_sbindir}/alternatives --install /bin/ksh ksh \ @@ -213,9 +273,12 @@ if [ $1 = 0 ]; then fi %postun -if [ ! -f /bin/ksh ]; then - sed -i '/^\/bin\/ksh$/ d' /etc/shells -fi +for s in /bin/ksh /bin/rksh +do + if [ ! -f $s ]; then + sed -i '\|^'"$s"'$|d' /etc/shells + fi +done %verifyscript echo -n "Looking for ksh in /etc/shells... " @@ -231,6 +294,7 @@ fi %doc src/cmd/ksh93/COMPATIBILITY src/cmd/ksh93/RELEASE src/cmd/ksh93/TYPES # LICENSE file is missing, temporarily? /bin/ksh93 +/bin/rksh %ghost /bin/ksh /usr/bin/shcomp %{_mandir}/man1/ksh93.1.gz @@ -243,6 +307,29 @@ fi rm -rf $RPM_BUILD_ROOT %changelog +* Mon Nov 24 2014 Michal Hlavinka - 20120801-22 +- fix postun scriptlet (#1146161) + +* Tue Sep 30 2014 Michal Hlavinka - 20120801-21 +- include symlink for restricted shell (#1146161) +- ksh hangs when command substitution containing pipe fills out the pipe buffer (#1138751) +- current directory could differ from PWD (#1135573) +- cd builtin could break IO redirection (#1133585) +- return code from a function could be wrong (#1116507) + +* Tue Jul 22 2014 Michal Hlavinka - 20120801-20 +- fix segfault in job list code (#1084406) +- do not resend signal on termination (#1085385) +- fix brace expansion on/off (#1099935) +- fix incorrect rounding of numsers 0.5 < |x| <1.0 in printf (#1070871) +- fix parser errors related to the end of the here-document marker (#1111120) +- ksh hangs when command substitution fills out the pipe buffer (#1077090) +- using typeset -l with a restricted variabled caused segmentation fault (#1121960) +- monitor mode was documented incorrectly (#1100215) +- do not crash when unsetting running function from another one (#1100215) +- should report an error when trying to cd into directory without execution bit (#1109893) +- job locking mechanism did not survive compiler optimization (#1116506) + * 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)