From 9df98390b4028fbc92296105374472697babd7a359813d26cbfa390b5c6968c1 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Tue, 2 Oct 2007 23:02:00 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ksh?expand=0&rev=8 --- INIT.2007-03-28.tar.bz2 | 3 - INIT.2007-06-28.tar.bz2 | 3 + ast-ksh.2007-03-28.tar.bz2 | 3 - ast-ksh.2007-06-28.tar.bz2 | 3 + ksh.changes | 40 +++++++++++ ksh.spec | 65 ++++++++++++++--- ksh93-fs3d.dif | 28 ++++++++ ksh93-keytrap-overflow.dif | 19 +++++ ksh93-profile.dif | 2 +- ksh93-realloc.dif | 144 +++++++++++++++++++++++++++++++++++++ ksh93-suid_exec.dif | 2 +- ksh93.dif | 8 +-- ksh93s-fix.dif | 116 ++++++++++++++++++++++++++++++ 13 files changed, 415 insertions(+), 21 deletions(-) delete mode 100644 INIT.2007-03-28.tar.bz2 create mode 100644 INIT.2007-06-28.tar.bz2 delete mode 100644 ast-ksh.2007-03-28.tar.bz2 create mode 100644 ast-ksh.2007-06-28.tar.bz2 create mode 100644 ksh93-fs3d.dif create mode 100644 ksh93-keytrap-overflow.dif create mode 100644 ksh93-realloc.dif create mode 100644 ksh93s-fix.dif diff --git a/INIT.2007-03-28.tar.bz2 b/INIT.2007-03-28.tar.bz2 deleted file mode 100644 index 6b584bd..0000000 --- a/INIT.2007-03-28.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4c2c5bcb261bfac49cb736056630f20eb0fbc98492b2487085fd5283e87aecdc -size 258521 diff --git a/INIT.2007-06-28.tar.bz2 b/INIT.2007-06-28.tar.bz2 new file mode 100644 index 0000000..d4d443f --- /dev/null +++ b/INIT.2007-06-28.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b6ea117003ec4535012a4a3139fbb746e0ad54c57ef6ba5cf662f46d797a9f60 +size 259047 diff --git a/ast-ksh.2007-03-28.tar.bz2 b/ast-ksh.2007-03-28.tar.bz2 deleted file mode 100644 index 4d42163..0000000 --- a/ast-ksh.2007-03-28.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:63fc059d37cd3e2e797efc414d90e63a89726c027ad438a3e3494237aba7b1d3 -size 1306654 diff --git a/ast-ksh.2007-06-28.tar.bz2 b/ast-ksh.2007-06-28.tar.bz2 new file mode 100644 index 0000000..de9f236 --- /dev/null +++ b/ast-ksh.2007-06-28.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d9c8d632c2959bd1736fe47fd6825c255e1bda2df238a64518c22456ce9711b +size 1316142 diff --git a/ksh.changes b/ksh.changes index 0f40901..c06634b 100644 --- a/ksh.changes +++ b/ksh.changes @@ -1,3 +1,43 @@ +------------------------------------------------------------------- +Mon Sep 17 13:16:53 CEST 2007 - werner@suse.de + +- Update to bugfix version 2007-06-28 of ksh93s+ (bug #263053) + * In vi insert mode, ksh no longer emits a backspace character + before the carriage return when the newline is entered + * A bug in which pipefail would cause a command to return 0 + when the pipeline was the last command and the failure + happened on a component other than the last has been fixed + * A bug in the expansion of ${var/pattern/rep} when pattern + or rep contained a left parenthesis in single quotes has + been fixed + * The braces for a subscripted variable with ${var[sub]} are + now optional when inside [[...]], ((...)) or as a subscript + * A bug in brace expansion in which single and double quotes + did not treat the comma as a literal character has been fixed + * The -p option of whence now disables -v + * Several bug fixes in compound variables and arrays of arrays + have been made + * A bug in which the %B format of printf was affected by the + locale has been fixed + * A bug in which \ was not removed in the replacement pattern + with ${var/pattern/rep} when it was not followed by \ or a + digit has been fixed + * A bug in which ksh -R file core dumped if no script was + specified has been fixed, it now displays an error message + * Added additional Solaris signals to signal table + * A bug in which a pipeline with command substitution inside + a function could cause a pipeline that invokes this function + to hang when the pipefail option is on has been fixed + * Added -q to whence + * A small memory leak with each redirection of a non-builtin + has been fixed +- Fix many wrong detected limits for Linux like INT_MAX +- Adapt FS3D file system: mount(2) of Linux uses five arguments +- Fix bug in pointer arithmetic: after reallocation the addresses + of the old area of an pointer array are changed (bug #300653) +- Overflow in keytrap(): strncpy(3) does not append ASCII 0 if + buffer is fully used + ------------------------------------------------------------------- Wed Jun 20 15:15:28 CEST 2007 - werner@suse.de diff --git a/ksh.spec b/ksh.spec index e600c74..0c63f0f 100644 --- a/ksh.spec +++ b/ksh.spec @@ -12,17 +12,17 @@ Name: ksh BuildRequires: bind-libs bind-utils bison flex gdbm-devel glibc-devel libbz2-devel ncurses-devel procps psmisc pwdutils zlib-devel -URL: http://www.research.att.com/~gsf/download/ +Url: http://www.research.att.com/~gsf/download/ License: Common Public License Version 1.0 (CPL1.0) Group: System/Shells PreReq: /bin/ln /etc/bash.bashrc /bin/true -Autoreqprov: on +AutoReqProv: on Version: 93s -Release: 24 +Release: 49 Summary: Korn Shell BuildRoot: %{_tmppath}/%{name}-%{version}-build -Source: INIT.2007-03-28.tar.bz2 -Source1: ast-ksh.2007-03-28.tar.bz2 +Source: INIT.2007-06-28.tar.bz2 +Source1: ast-ksh.2007-06-28.tar.bz2 Source2: Agreement Source3: Warning Source30: rpmlintrc @@ -37,6 +37,10 @@ Patch7: ksh93-profile.dif Patch8: ksh93-test.dif Patch9: ksh93-compat.dif Patch10: ksh93-suid_exec.dif +Patch11: ksh93s-fix.dif +Patch12: ksh93-fs3d.dif +Patch13: ksh93-realloc.dif +Patch14: ksh93-keytrap-overflow.dif %description The original Korn Shell. The ksh is an sh-compatible command @@ -55,7 +59,7 @@ Authors: Summary: Korn Shell development environment Group: Development/Libraries/C and C++ Requires: ksh = %{version}-%{release} -Autoreqprov: on +AutoReqProv: on %description -n ksh-devel The package includes C header files and the static libraries together @@ -86,6 +90,10 @@ Authors: %patch8 %patch9 %patch10 +%patch11 +%patch12 +%patch13 +%patch14 %build # @@ -95,9 +103,12 @@ Authors: IGNORE="-Wno-missing-braces -Wno-unknown-pragmas -Wno-parentheses" IGNORE="$IGNORE -Wno-char-subscripts -Wno-uninitialized -Wno-implicit" # + # Do not use -DSHOPT_SPAWN=1 and/or -DSHOPT_AMP=1 this would cause + # errors due race conditions while executing the test suite. # FEATURE="-DSHOPT_SYSRC=1 -DSHOPT_REMOTE=1 -DSHOPT_CMDLIB_BLTIN=1" - FEATURE="$FEATURE -DSH_CMDLIB_DIR=\\\"/%{_lib}/ast/bin\\\" -DDEFSHELL=\\\"/bin/ksh\\\"" + FEATURE="$FEATURE -DSH_CMDLIB_DIR=\\\"/%{_lib}/ast/bin\\\"" + FEATURE="$FEATURE -DDEFSHELL=\\\"/bin/ksh\\\"" FEATURE="$FEATURE -DTHISPROG=\\\"/%{_lib}/ast/bin/suid_exec\\\"" # # @@ -170,7 +181,7 @@ Authors: ${suidex} -Wl,-rpath-link,${root}/lib -Wl,-rpath,/%{_lib}/ast pushd ${test} sleep 5 - LD_LIBRARY_PATH=${root}/lib SHELL=${root}/bin/ksh ${root}/bin/ksh shtests + LD_LIBRARY_PATH=${root}/lib SHELL=${root}/bin/ksh ${root}/bin/ksh shtests popd pushd ${root}/bin set -- $(LD_LIBRARY_PATH=${root}/lib PATH=$PATH:. shcomp --version 2>&1) @@ -276,8 +287,44 @@ fi %{_libdir}/ast/*.a %doc %{_mandir}/man3/* %{_includedir}/ast/ - %changelog +* Mon Sep 17 2007 - werner@suse.de +- Update to bugfix version 2007-06-28 of ksh93s+ (bug #263053) + * In vi insert mode, ksh no longer emits a backspace character + before the carriage return when the newline is entered + * A bug in which pipefail would cause a command to return 0 + when the pipeline was the last command and the failure + happened on a component other than the last has been fixed + * A bug in the expansion of ${var/pattern/rep} when pattern + or rep contained a left parenthesis in single quotes has + been fixed + * The braces for a subscripted variable with ${var[sub]} are + now optional when inside [[...]], ((...)) or as a subscript + * A bug in brace expansion in which single and double quotes + did not treat the comma as a literal character has been fixed + * The -p option of whence now disables -v + * Several bug fixes in compound variables and arrays of arrays + have been made + * A bug in which the %%B format of printf was affected by the + locale has been fixed + * A bug in which \ was not removed in the replacement pattern + with ${var/pattern/rep} when it was not followed by \ or a + digit has been fixed + * A bug in which ksh -R file core dumped if no script was + specified has been fixed, it now displays an error message + * Added additional Solaris signals to signal table + * A bug in which a pipeline with command substitution inside + a function could cause a pipeline that invokes this function + to hang when the pipefail option is on has been fixed + * Added -q to whence + * A small memory leak with each redirection of a non-builtin + has been fixed +- Fix many wrong detected limits for Linux like INT_MAX +- Adapt FS3D file system: mount(2) of Linux uses five arguments +- Fix bug in pointer arithmetic: after reallocation the addresses + of the old area of an pointer array are changed (bug #300653) +- Overflow in keytrap(): strncpy(3) does not append ASCII 0 if + buffer is fully used * Wed Jun 20 2007 - werner@suse.de - Fix pointer arithmetics within sh_trim() (bug #284611) * Tue Jun 19 2007 - werner@suse.de diff --git a/ksh93-fs3d.dif b/ksh93-fs3d.dif new file mode 100644 index 0000000..e20b120 --- /dev/null +++ b/ksh93-fs3d.dif @@ -0,0 +1,28 @@ +--- src/lib/libast/misc/fs3d.c ++++ src/lib/libast/misc/fs3d.c 2007-09-13 18:28:57.279134727 +0200 +@@ -47,7 +47,8 @@ + /* + * get the current setting + */ +- ++ if (getenv("LD_PRELOAD") == (char*)0) ++ goto nope; + if (!fsview && mount("", "", 0, NiL)) + goto nope; + if (FS3D_op(op) == FS3D_OP_INIT && mount(FS3D_init, NiL, FS3D_VIEW, NiL)) +--- src/lib/libast/include/fs3d.h ++++ src/lib/libast/include/fs3d.h 2007-09-13 18:28:57.279134727 +0200 +@@ -95,7 +95,13 @@ + #define FS3D_SIZE(n) ((n)<<4) + #define FS3D_SIZEOF(n) ((n)>>4) + ++#if _sys_mount && defined(__linux__) ++#include ++#define mount(source,target,flags,data) \ ++ mount((source),(target),"",(flags),(data)) ++#else + extern int mount(const char*, char*, int, void*); ++#endif + + #if _BLD_ast && defined(__EXPORT__) + #define extern __EXPORT__ diff --git a/ksh93-keytrap-overflow.dif b/ksh93-keytrap-overflow.dif new file mode 100644 index 0000000..0d8d1f6 --- /dev/null +++ b/ksh93-keytrap-overflow.dif @@ -0,0 +1,19 @@ +--- src/cmd/ksh93/edit/edit.c ++++ src/cmd/ksh93/edit/edit.c 2007-09-16 23:57:45.000000000 +0200 +@@ -1478,8 +1478,14 @@ + nv_unset(ED_CHRNOD); + else + { +- strncpy(inbuff,cp,bufsize); +- insize = strlen(inbuff); ++ if (bufsize>0) ++ { ++ strncpy(inbuff,cp,bufsize); ++ inbuff[bufsize-1]='\0'; ++ insize = strlen(inbuff); ++ } ++ else ++ insize=0; + } + nv_unset(ED_TXTNOD); + return(insize); diff --git a/ksh93-profile.dif b/ksh93-profile.dif index e0bd1b6..1c7c21f 100644 --- a/ksh93-profile.dif +++ b/ksh93-profile.dif @@ -3,7 +3,7 @@ @@ -210,37 +210,42 @@ } job_init(sh_isoption(SH_LOGIN_SHELL)); - if(sh_isoption(SH_LOGIN_SHELL) && !sh_isoption(SH_NOPROFILE)) + if(sh_isoption(SH_LOGIN_SHELL)) - { /* system profile */ sh_source(shp, iop, e_sysprofile); diff --git a/ksh93-realloc.dif b/ksh93-realloc.dif new file mode 100644 index 0000000..c78a2f2 --- /dev/null +++ b/ksh93-realloc.dif @@ -0,0 +1,144 @@ +--- src/cmd/ksh93/sh/io.c ++++ src/cmd/ksh93/sh/io.c 2007-09-14 18:15:17.000000000 +0200 +@@ -380,7 +380,7 @@ + { + register int n; + filemapsize = 8; +- filemap = (struct fdsave*)malloc(8*sizeof(struct fdsave)); ++ filemap = (struct fdsave*)malloc(filemapsize*sizeof(struct fdsave)); + #if SHOPT_FASTPIPE + n = sh.lim.open_max+2; + #else +@@ -502,7 +502,7 @@ + if(f2==job.fd) + job.fd=fd; + *sh.fdptrs[fd] = fd; +- sh.fdptrs[f2] = 0; ++ sh.fdptrs[f2] = (int*)0; + } + sh.sftable[fd] = sp; + sh.fdstatus[fd] = sh.fdstatus[f2]; +@@ -578,7 +578,7 @@ + sh.fdstatus[fd] = IOCLOSE; + if(sh.fdptrs[fd]) + *sh.fdptrs[fd] = -1; +- sh.fdptrs[fd] = 0; ++ sh.fdptrs[fd] = (int*)0; + if(fd < 10) + sh.inuse_bits &= ~(1<= filemapsize) + { ++ long oldptr = (long)filemap; ++ long moved; ++ + filemapsize += 8; + if(!(filemap = (struct fdsave*)realloc(filemap,filemapsize*sizeof(struct fdsave)))) + errormsg(SH_DICT,ERROR_exit(4),e_nospace); +- ++ moved = (long)filemap - oldptr; ++ ++ /* realloc(2) possibly has moved start address of filemap */ ++#if SHOPT_FASTPIPE ++ for(savefd=sh.lim.open_max+2; --savefd>=0; ) ++#else ++ for(savefd=sh.lim.open_max; --savefd>=0; ) ++#endif /* SHOPT_FASTPIPE */ ++ { ++ if (sh.fdptrs[savefd]) /* update address if used */ ++ { ++ oldptr = (long)sh.fdptrs[savefd]; ++ if (oldptr == (long)(&sh.coutpipe)) ++ continue; ++ if (oldptr == (long)(&sh.cpipe[0])) ++ continue; ++ sh.fdptrs[savefd] = (int*)(oldptr+moved); ++ } ++ } + } + #if SHOPT_DEVFD + if(origfd <0) +--- src/cmd/ksh93/sh/jobs.c ++++ src/cmd/ksh93/sh/jobs.c 2007-09-12 14:25:34.000000000 +0000 +@@ -1011,12 +1011,14 @@ void job_clear(void) + { + pw = pw->p_nxtproc; + free((void*)px); ++ px = (struct process *)0; + } + } + for(jp=bck.list; jp;jp=jpnext) + { + jpnext = jp->next; + free((void*)jp); ++ jp = (struct jobsave *)0; + } + bck.list = 0; + if(njob_savelist < NJOB_SAVELIST) +@@ -1638,7 +1640,10 @@ static int job_chksave(register pid_t pi + job_savelist = jp; + } + else ++ { + free((void*)jp); ++ jp = (struct jobsave *)0; ++ } + } + return(r); + } +@@ -1673,6 +1678,7 @@ void job_subrestore(void* ptr) + { + jpnext = jp->next; + free((void*)jp); ++ jp = (struct jobsave *)0; + } + free(ptr); + job_unlock(); +--- src/cmd/ksh93/sh/macro.c ++++ src/cmd/ksh93/sh/macro.c 2007-09-14 10:13:04.000000000 +0000 +@@ -1829,9 +1829,19 @@ static void comsubst(Mac_t *mp,int type) + mac_copy(mp,&lastc,1); + lastc = 0; + } ++ /* nothing todo */ ++ if(c <= 0) ++ continue; + /* delay appending trailing new-lines */ + while(str[--c]=='\n') ++ { + newlines++; ++ if(c == 0) ++ { ++ c--; ++ break; ++ } ++ } + if(++c < bufsize) + str[c] = 0; + else +--- src/cmd/ksh93/sh/xec.c ++++ src/cmd/ksh93/sh/xec.c 2007-09-14 18:16:17.000000000 +0200 +@@ -755,10 +755,11 @@ + if(np && is_abuiltin(np)) + { + void *context; +- int scope=0, jmpval, save_prompt,share; ++ int scope=0, jmpval, save_prompt,share=0; + struct checkpt buff; + unsigned long was_vi=0, was_emacs=0, was_gmacs=0; + struct stat statb; ++ memset(&statb, 0, sizeof(struct stat)); + if(strchr(nv_name(np),'/')) + { + /* +@@ -2539,7 +2540,7 @@ + } + if(fcntl(*sh.cpipe,F_SETFD,FD_CLOEXEC)>=0) + sh.fdstatus[sh.cpipe[0]] |= IOCLEX; +- sh.fdptrs[sh.cpipe[0]] = sh.cpipe; ++ sh.fdptrs[sh.cpipe[0]] = &sh.cpipe[0]; + + if(fcntl(sh.cpipe[1],F_SETFD,FD_CLOEXEC) >=0) + sh.fdstatus[sh.cpipe[1]] |= IOCLEX; diff --git a/ksh93-suid_exec.dif b/ksh93-suid_exec.dif index 46b3ce2..505d315 100644 --- a/ksh93-suid_exec.dif +++ b/ksh93-suid_exec.dif @@ -27,7 +27,7 @@ +# define DEFSHELL "/bin/sh" +#endif - #if defined(linux) + #if defined(__linux__) static void error_exit(const char*) __attribute__ ((noreturn)); @@ -76,11 +80,14 @@ static int endsh(const char*); # undef _lib_setreuid diff --git a/ksh93.dif b/ksh93.dif index 2073847..7054e6b 100644 --- a/ksh93.dif +++ b/ksh93.dif @@ -38,7 +38,7 @@ #define THISPROG "/etc/suid_exec" #define DEFSHELL "/bin/sh" -+#if defined(linux) ++#if defined(__linux__) +static void error_exit(const char*) __attribute__ ((noreturn)); +#else static void error_exit(const char*); @@ -135,7 +135,7 @@ int notify = 0; int ignore = 0; -#if _lib_lchmod -+#if !defined(linux) && _lib_lchmod ++#if !defined(__linux__) && _lib_lchmod int chlink = 0; #endif struct stat st; @@ -144,7 +144,7 @@ continue; case 'h': -#if _lib_lchmod -+#if !defined(linux) && _lib_lchmod ++#if !defined(__linux__) && _lib_lchmod chlink = 1; #endif continue; @@ -153,7 +153,7 @@ } chmodf = -#if _lib_lchmod -+#if !defined(linux) && _lib_lchmod ++#if !defined(__linux__) && _lib_lchmod chlink ? lchmod : #endif chmod; diff --git a/ksh93s-fix.dif b/ksh93s-fix.dif new file mode 100644 index 0000000..bb03adb --- /dev/null +++ b/ksh93s-fix.dif @@ -0,0 +1,116 @@ +--- src/cmd/ksh93/sh/jobs.c ++++ src/cmd/ksh93/sh/jobs.c Tue Aug 28 12:58:29 2007 +@@ -43,6 +43,8 @@ + # define WIFCONTINUED(wstat) (0) + #endif + ++#define NJOB_SAVELIST 4 ++ + /* + * temporary hack to get W* macros to work + */ +@@ -59,13 +61,35 @@ + unsigned short exitval; + }; + ++static struct jobsave *job_savelist; ++static int njob_savelist; ++ ++static void init_savelist(void) ++{ ++ register struct jobsave *jp; ++ while(njob_savelist < NJOB_SAVELIST) ++ { ++ jp = newof(0,struct jobsave,1,0); ++ jp->next = job_savelist; ++ job_savelist = jp; ++ njob_savelist++; ++ } ++} ++ + /* + * return next on link list of jobsave free list + */ + static struct jobsave *jobsave_create(pid_t pid) + { +- struct jobsave *jp; +- if(jp = newof(0,struct jobsave,1,0)) ++ register struct jobsave *jp = job_savelist; ++ if(jp) ++ { ++ njob_savelist--; ++ job_savelist = jp->next; ++ } ++ else ++ jp = newof(0,struct jobsave,1,0); ++ if(jp) + jp->pid = pid; + return(jp); + } +@@ -371,6 +395,8 @@ + # if defined(SIGCLD) && (SIGCLD!=SIGCHLD) + signal(SIGCLD,job_waitsafe); + # endif ++ if(njob_savelist < NJOB_SAVELIST) ++ init_savelist(); + if(!sh_isoption(SH_INTERACTIVE)) + return; + /* use new line discipline when available */ +@@ -993,6 +1019,8 @@ + free((void*)jp); + } + bck.list = 0; ++ if(njob_savelist < NJOB_SAVELIST) ++ init_savelist(); + job.pwlist = NIL(struct process*); + job.numpost=0; + job.waitall = 0; +@@ -1015,6 +1043,8 @@ + register struct process *pw; + register History_t *hp = sh.hist_ptr; + sh.jobenv = sh.curenv; ++ if(njob_savelist < NJOB_SAVELIST) ++ init_savelist(); + if(job.toclear) + { + job_clear(); +@@ -1273,7 +1303,13 @@ + px->p_flag &= ~P_EXITSAVE; + } + } +- if(!(px=job_unpost(pw,1)) || !job.waitall) ++ if(!job.waitall) ++ { ++ if(!sh_isoption(SH_PIPEFAIL)) ++ job_unpost(pw,1); ++ break; ++ } ++ else if(!(px=job_unpost(pw,1))) + break; + pw = px; + continue; +@@ -1312,6 +1348,8 @@ + else + tty_set(-1, 0, NIL(struct termios*)); + done: ++ if(!job.waitall && sh_isoption(SH_PIPEFAIL)) ++ return; + if(!sh.intrap) + { + job_lock(); +@@ -1593,7 +1631,14 @@ + else + bck.list = jp->next; + bck.count--; +- free((void*)jp); ++ if(njob_savelist < NJOB_SAVELIST) ++ { ++ njob_savelist++; ++ jp->next = job_savelist; ++ job_savelist = jp; ++ } ++ else ++ free((void*)jp); + } + return(r); + }