SOURCES: pdksh-debian.patch - updated
arekm
arekm at pld-linux.org
Thu May 8 08:36:12 CEST 2008
Author: arekm Date: Thu May 8 06:36:12 2008 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- updated
---- Files affected:
SOURCES:
pdksh-debian.patch (1.4 -> 1.5)
---- Diffs:
================================================================
Index: SOURCES/pdksh-debian.patch
diff -u SOURCES/pdksh-debian.patch:1.4 SOURCES/pdksh-debian.patch:1.5
--- SOURCES/pdksh-debian.patch:1.4 Wed Nov 8 09:07:21 2006
+++ SOURCES/pdksh-debian.patch Thu May 8 08:36:06 2008
@@ -1,432 +1,333 @@
---- pdksh-5.2.14.orig/alloc.c
-+++ pdksh-5.2.14/alloc.c
-@@ -1,3 +1,5 @@
-+#ifndef DEBIAN
-+
- /*
- * area-based allocation built on malloc/free
- */
-@@ -110,6 +112,13 @@
- Block *block;
- struct {int _;} junk; /* alignment */
- double djunk; /* alignment */
-+#ifdef DEBIAN /* patch from RedHat */
-+#ifdef __ia64__
-+ /* IA64 requires 16 byte alignment for some objects, so make
-+ * this the minimum allocation size */
-+ char ajunk[16];
-+#endif
-+#endif
- };
-
- struct Block {
-@@ -282,7 +291,9 @@
- * working (as it assumes size < ICELLS means it is not
- * a `large object').
- */
-- if (oldcells > ICELLS && cells > ICELLS) {
-+ if (oldcells > ICELLS && cells > ICELLS
-+ && ((dp-2)->block->last == dp+oldcells) /* don't destroy blocks which have grown! */
-+ ) {
- Block *bp = (dp-2)->block;
- Block *nbp;
- /* Saved in case realloc fails.. */
-@@ -332,7 +343,7 @@
- * (need to check that cells < ICELLS so we don't make an
- * object a `large' - that would mess everything up).
- */
-- if (dp && cells > oldcells && cells <= ICELLS) {
-+ if (dp && cells > oldcells) {
- Cell *fp, *fpp;
- Block *bp = (dp-2)->block;
- int need = cells - oldcells - NOBJECT_FIELDS;
-@@ -363,7 +374,7 @@
- * it to malloc...)
- * Note: this also handles cells == oldcells (a no-op).
- */
-- if (dp && cells <= oldcells && oldcells <= ICELLS) {
-+ if (dp && cells <= oldcells) {
- int split;
-
- split = oldcells - cells;
-@@ -411,7 +422,9 @@
-
- /* If this is a large object, just free it up... */
- /* Release object... */
-- if ((dp-1)->size > ICELLS) {
-+ if ((dp-1)->size > ICELLS
-+ && (bp->last == dp + (dp-1)->size) /* don't free non-free blocks which have grown! */
-+ ) {
- ablockfree(bp, ap);
- ACHECK(ap);
- return;
-@@ -774,3 +787,127 @@
- # endif /* TEST_ALLOC */
+ * Applied patch from upstream ftp site to fix problem with readonly
+ variables (closes: #57727).
+Index: pdksh/jobs.c
+===================================================================
+--- pdksh.orig/jobs.c 2008-04-15 20:47:52.000000000 +0200
++++ pdksh/jobs.c 2008-04-15 20:48:46.000000000 +0200
+@@ -219,8 +219,7 @@
+ static void check_job ARGS((Job *j));
+ static void put_job ARGS((Job *j, int where));
+ static void remove_job ARGS((Job *j, const char *where));
+-static void kill_job ARGS((Job *j));
+-static void fill_command ARGS((char *c, int len, struct op *t));
++static int kill_job ARGS((Job *j, int sig));
- #endif /* MEM_DEBUG */
-+
-+#else /* DEBIAN */ /* patch from OpenBSD */
-+
-+/* $OpenBSD: alloc.c,v 1.6 2003/08/05 20:52:27 millert Exp $ */
-+/*
-+ * Copyright (c) 2002 Marc Espie.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
-+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBSD
-+ * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+ */
-+
-+/*
-+ * area-based allocation built on malloc/free
-+ */
-+
-+#include "sh.h"
-+
-+struct link {
-+ struct link *prev;
-+ struct link *next;
-+};
-+
-+Area *
-+ainit(Area *ap)
-+{
-+ ap->freelist = NULL;
-+ return ap;
-+}
-+
-+void
-+afreeall(Area *ap)
-+{
-+ struct link *l, *l2;
-+
-+ for (l = ap->freelist; l != NULL; l = l2) {
-+ l2 = l->next;
-+ free(l);
-+ }
-+ ap->freelist = NULL;
-+}
-+
-+#define L2P(l) ( (void *)(((char *)(l)) + sizeof(struct link)) )
-+#define P2L(p) ( (struct link *)(((char *)(p)) - sizeof(struct link)) )
-+
-+void *
-+alloc(size_t size, Area *ap)
-+{
-+ struct link *l;
-+
-+ l = malloc(size + sizeof(struct link));
-+ if (l == NULL)
-+ internal_errorf(1, "unable to allocate memory");
-+ l->next = ap->freelist;
-+ l->prev = NULL;
-+ if (ap->freelist)
-+ ap->freelist->prev = l;
-+ ap->freelist = l;
-+
-+ return L2P(l);
-+}
-+
-+void *
-+aresize(void *ptr, size_t size, Area *ap)
-+{
-+ struct link *l, *l2, *lprev, *lnext;
-+
-+ if (ptr == NULL)
-+ return alloc(size, ap);
-+
-+ l = P2L(ptr);
-+ lprev = l->prev;
-+ lnext = l->next;
-+
-+ l2 = realloc(l, size+sizeof(struct link));
-+ if (l2 == NULL)
-+ internal_errorf(1, "unable to allocate memory");
-+ if (lprev)
-+ lprev->next = l2;
-+ else
-+ ap->freelist = l2;
-+ if (lnext)
-+ lnext->prev = l2;
-+
-+ return L2P(l2);
-+}
-+
-+void
-+afree(void *ptr, Area *ap)
-+{
-+ struct link *l;
-+
-+ if (!ptr)
-+ return;
-+
-+ l = P2L(ptr);
-+
-+ if (l->prev)
-+ l->prev->next = l->next;
-+ else
-+ ap->freelist = l->next;
-+ if (l->next)
-+ l->next->prev = l->prev;
-+
-+ free(l);
-+}
-+#endif /* DEBIAN */
---- pdksh-5.2.14.orig/c_ksh.c
-+++ pdksh-5.2.14/c_ksh.c
-@@ -1110,13 +1110,14 @@
- return 1;
+ /* initialize job control */
+ void
+@@ -294,10 +293,17 @@
+ && procpid == kshpid)))))
+ {
+ killed = 1;
+- killpg(j->pgrp, SIGHUP);
++ if (j->pgrp == 0)
++ kill_job(j, SIGHUP);
++ else
++ killpg(j->pgrp, SIGHUP);
+ #ifdef JOBS
+- if (j->state == PSTOPPED)
+- killpg(j->pgrp, SIGCONT);
++ if (j->state == PSTOPPED) {
++ if (j->pgrp == 0)
++ kill_job(j, SIGCONT);
++ else
++ killpg(j->pgrp, SIGCONT);
++ }
+ #endif /* JOBS */
}
- wp += builtin_opt.optind;
-- if (!*wp)
-+ if (!*wp) {
- if (j_jobs((char *) 0, flag, nflag))
- rv = 1;
-- else
-+ } else {
- for (; *wp; wp++)
- if (j_jobs(*wp, flag, nflag))
- rv = 1;
-+ }
- return rv;
- }
+ }
+@@ -497,7 +503,7 @@
+ put_job(j, PJ_PAST_STOPPED);
+ }
-@@ -1208,6 +1209,7 @@
- builtin_opt.optarg);
- return 1;
- }
-+ break;
- case '?':
- return 1;
- }
---- pdksh-5.2.14.orig/c_sh.c
-+++ pdksh-5.2.14/c_sh.c
-@@ -422,7 +422,8 @@
- c_eval(wp)
- char **wp;
- {
-- register struct source *s;
-+ register struct source *s,*olds=source;
-+ int retval, errexitflagtmp;
+- fill_command(p->command, sizeof(p->command), t);
++ snptreef(p->command, sizeof(p->command), "%T", t);
- if (ksh_getopt(wp, &builtin_opt, null) == '?')
- return 1;
-@@ -455,8 +456,12 @@
- */
- exstat = subst_exstat;
+ /* create child process */
+ forksleep = 1;
+@@ -508,7 +514,7 @@
+ forksleep <<= 1;
}
--
-- return shell(s, FALSE);
-+ errexitflagtmp = Flag(FERREXIT);
-+ Flag(FERREXIT) = 0;
-+ retval=shell(s, FALSE);
-+ Flag(FERREXIT) = errexitflagtmp;
-+ source=olds;
-+ return retval;
- }
-
- int
-@@ -643,6 +648,7 @@
- for (wp = l->argv; (*wp++ = *owp++) != NULL; )
- ;
+ if (i < 0) {
+- kill_job(j);
++ kill_job(j, SIGKILL);
+ remove_job(j, "fork failed");
+ #ifdef NEED_PGRP_SYNC
+ if (j_sync_open) {
+@@ -823,11 +829,10 @@
}
-+#ifndef DEBIAN
- /* POSIX says set exit status is 0, but old scripts that use
- * getopt(1), use the construct: set -- `getopt ab:c "$@"`
- * which assumes the exit value set will be that of the ``
-@@ -650,6 +656,12 @@
- * if there are no command substitutions).
- */
- return Flag(FPOSIX) ? 0 : subst_exstat;
-+#else
-+ /* On Debian we always want set to return 0 like ksh93 does.
-+ * See: Bug#118476.
-+ */
-+ return 0;
-+#endif /* DEBIAN */
- }
- int
-@@ -844,7 +856,7 @@
- * keeps them open).
- */
- #ifdef KSH
-- if (i > 2 && e->savefd[i])
-+ if (!Flag(FSH) &&i > 2 && e->savefd[i])
- fd_clexec(i);
- #endif /* KSH */
- }
---- pdksh-5.2.14.orig/c_test.c
-+++ pdksh-5.2.14/c_test.c
-@@ -124,10 +124,10 @@
- te.pos.wp = wp + 1;
- te.wp_end = wp + argc;
+ if (j->pgrp == 0) { /* started when !Flag(FMONITOR) */
+- for (p=j->proc_list; p != (Proc *) 0; p = p->next)
+- if (kill(p->pid, sig) < 0) {
+- bi_errorf("%s: %s", cp, strerror(errno));
+- rv = 1;
+- }
++ if (kill_job(j, sig) < 0) {
++ bi_errorf("%s: %s", cp, strerror(errno));
++ rv = 1;
++ }
+ } else {
+ #ifdef JOBS
+ if (j->state == PSTOPPED && (sig == SIGTERM || sig == SIGHUP))
+@@ -1825,50 +1830,17 @@
+ *
+ * If jobs are compiled in then this routine expects sigchld to be blocked.
+ */
+-static void
+-kill_job(j)
++static int
++kill_job(j, sig)
+ Job *j;
++ int sig;
+ {
+ Proc *p;
++ int rval = 0;
-- /*
-+ /*
- * Handle the special cases from POSIX.2, section 4.62.4.
-- * Implementation of all the rules isn't necessary since
-- * our parser does the right thing for the ommited steps.
-+ * Implementation of all the rules isn't necessary since
-+ * our parser does the right thing for the omitted steps.
- */
- if (argc <= 5) {
- char **owp = wp;
-@@ -238,7 +238,7 @@
- if (not)
- res = !res;
- }
-- return res;
-+ return res;
- case TO_FILRD: /* -r */
- return test_eaccess(opnd1, R_OK) == 0;
- case TO_FILWR: /* -w */
-@@ -338,7 +338,7 @@
- case TO_FILUID: /* -O */
- return test_stat(opnd1, &b1) == 0 && b1.st_uid == ksheuid;
- case TO_FILGID: /* -G */
-- return test_stat(opnd1, &b1) == 0 && b1.st_gid == getegid();
-+ return test_stat(opnd1, &b1) == 0 && b1.st_gid == kshegid;
- /*
- * Binary Operators
- */
-@@ -456,10 +456,12 @@
+ for (p = j->proc_list; p != (Proc *) 0; p = p->next)
+ if (p->pid != 0)
+- (void) kill(p->pid, SIGKILL);
+-}
+-
+-/* put a more useful name on a process than snptreef does (in certain cases) */
+-static void
+-fill_command(c, len, t)
+- char *c;
+- int len;
+- struct op *t;
+-{
+- int alen;
+- char **ap;
+-
+- if (t->type == TEXEC || t->type == TCOM) {
+- /* Causes problems when set -u is in effect, can also
+- cause problems when array indices evaluated (may have
+- side effects, eg, assignment, incr, etc.)
+- if (t->type == TCOM)
+- ap = eval(t->args, DOBLANK|DONTRUNCOMMAND);
+- else
+- */
+- ap = t->args;
+- --len; /* save room for the null */
+- while (len > 0 && *ap != (char *) 0) {
+- alen = strlen(*ap);
+- if (alen > len)
+- alen = len;
+- memcpy(c, *ap, alen);
+- c += alen;
+- len -= alen;
+- if (len > 0) {
+- *c++ = ' '; len--;
+- }
+- ap++;
+- }
+- *c = '\0';
+- } else
+- snptreef(c, len, "%T", t);
++ if (kill(p->pid, sig) < 0)
++ rval = -1;
++ return rval;
+ }
+Index: pdksh/shf.c
+===================================================================
+--- pdksh.orig/shf.c 2008-04-15 20:47:52.000000000 +0200
++++ pdksh/shf.c 2008-04-15 20:48:46.000000000 +0200
+@@ -355,7 +355,6 @@
+ shf->rp = nbuf + (shf->rp - shf->buf);
+ shf->wp = nbuf + (shf->wp - shf->buf);
+ shf->rbsize += shf->wbsize;
+- shf->wbsize += shf->wbsize;
+ shf->wnleft += shf->wbsize;
+ shf->wbsize *= 2;
+ shf->buf = nbuf;
+Index: pdksh/var.c
+===================================================================
+--- pdksh.orig/var.c 2008-04-15 20:47:52.000000000 +0200
++++ pdksh/var.c 2008-04-15 20:48:46.000000000 +0200
+@@ -353,7 +353,9 @@
+ const char *s;
+ int error_ok;
+ {
+- if (vq->flag & RDONLY) {
++ int no_ro_check = error_ok & 0x4;
++ error_ok &= ~0x4;
++ if ((vq->flag & RDONLY) && !no_ro_check) {
+ warningf(TRUE, "%s: is read only", vq->name);
+ if (!error_ok)
+ errorf(null);
+@@ -715,13 +717,13 @@
+ if (val != NULL) {
+ if (vp->flag&INTEGER) {
+ /* do not zero base before assignment */
+- setstr(vp, val, KSH_UNWIND_ERROR);
++ setstr(vp, val, KSH_UNWIND_ERROR | 0x4);
+ /* Done after assignment to override default */
+ if (base > 0)
+ vp->type = base;
+ } else
+ /* setstr can't fail (readonly check already done) */
+- setstr(vp, val, KSH_RETURN_ERROR);
++ setstr(vp, val, KSH_RETURN_ERROR | 0x4);
}
- #endif /* !HAVE_DEV_FD */
-- /* On most (all?) unixes, access() says everything is executable for
-+ res = eaccess(path, mode);
-+ /*
-+ * On most (all?) unixes, access() says everything is executable for
- * root - avoid this on files by using stat().
- */
-- if ((mode & X_OK) && ksheuid == 0) {
-+ if (res == 0 && ksheuid == 0 && (mode & X_OK)) {
- struct stat statb;
+ /* only x[0] is ever exported, so use vpbase */
+ * Applied patch from upstream author which fixed problem with 'set -e'
+ (closes: #71256).
+Index: pdksh/exec.c
+===================================================================
+--- pdksh.orig/exec.c 2008-04-15 20:46:56.000000000 +0200
++++ pdksh/exec.c 2008-04-15 20:49:17.000000000 +0200
+@@ -76,6 +76,7 @@
+ {
+ int i;
+ volatile int rv = 0;
++ volatile int rv_prop = 0; /* rv being propogated or newly generated? */
+ int pv[2];
+ char ** volatile ap;
+ char *s, *cp;
+@@ -157,6 +158,7 @@
- if (stat(path, &statb) < 0)
-@@ -469,13 +471,7 @@
+ case TPAREN:
+ rv = execute(t->left, flags|XFORK);
++ rv_prop = 1;
+ break;
+
+ case TPIPE:
+@@ -275,6 +277,7 @@
+ rv = execute(t->right, flags & XERROK);
else
- res = (statb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH))
- ? 0 : -1;
-- /* Need to check other permissions? If so, use access() as
-- * this will deal with root on NFS.
-- */
-- if (res == 0 && (mode & (R_OK|W_OK)))
-- res = eaccess(path, mode);
-- } else
-- res = eaccess(path, mode);
-+ }
+ flags |= XERROK;
++ rv_prop = 1;
+ break;
- return res;
- }
-@@ -660,3 +656,36 @@
- else
- bi_errorf("%s", msg);
- }
-+
-+
-+#ifdef DEBIAN
-+int eaccess(const char *pathname, int mode) {
-+ int need_setreuid, need_setregid;
-+ int result;
-+ int _errno;
-+
-+
-+
-+ if (( need_setregid = ( kshgid != kshegid ) )) {
-+ setregid( kshegid, kshgid );
-+ }
-+
-+ if (( need_setreuid = ( kshuid != ksheuid ) )) {
-+ setreuid( ksheuid, kshuid );
-+ }
-+
-+ result = access( pathname, mode );
-+ _errno = errno;
-+
-+ if ( need_setregid ) {
-+ setregid( kshgid, kshegid );
-+ }
-+
-+ if ( need_setreuid ) {
-+ setreuid( kshuid, ksheuid );
-+ }
-+
-+ errno = _errno;
-+ return result;
-+}
-+#endif
---- pdksh-5.2.14.orig/c_ulimit.c
-+++ pdksh-5.2.14/c_ulimit.c
-@@ -111,6 +111,9 @@
- #ifdef RLIMIT_SWAP
- { "swap(kbytes)", RLIMIT_SWAP, RLIMIT_SWAP, 1024, 'w' },
- #endif
-+#ifdef RLIMIT_LOCKS
-+ { "flocks", RLIMIT, RLIMIT_LOCKS, RLIMIT_LOCKS, -1, 'L' },
-+#endif
- { (char *) 0 }
- };
- static char options[3 + NELEM(limits)];
-@@ -189,7 +192,18 @@
- for (l = limits; l->name; l++) {
- #ifdef HAVE_SETRLIMIT
- if (l->which == RLIMIT) {
-- getrlimit(l->gcmd, &limit);
-+ int getreturn;
-+
-+ getreturn=getrlimit(l->gcmd, &limit);
-+#ifdef RLIMIT_LOCKS
-+ if ( getreturn < 0 ) {
-+ if ( ( errno == EINVAL ) &&
-+ ( l->gcmd == RLIMIT_LOCKS ) ) {
-+ limit.rlim_cur = RLIM_INFINITY;
-+ limit.rlim_max = RLIM_INFINITY;
-+ }
-+ }
<<Diff was trimmed, longer than 597 lines>>
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/pdksh-debian.patch?r1=1.4&r2=1.5&f=u
More information about the pld-cvs-commit
mailing list