Author: arekm Date: Wed Nov 8 08:07:26 2006 GMT Module: SOURCES Tag: HEAD ---- Log message: - updated from debian
---- Files affected: SOURCES: pdksh-debian.patch (1.3 -> 1.4) ---- Diffs: ================================================================ Index: SOURCES/pdksh-debian.patch diff -u SOURCES/pdksh-debian.patch:1.3 SOURCES/pdksh-debian.patch:1.4 --- SOURCES/pdksh-debian.patch:1.3 Sun Apr 25 02:35:58 2004 +++ SOURCES/pdksh-debian.patch Wed Nov 8 09:07:21 2006 @@ -1,19 +1,12 @@ -diff -urN pdksh-5.2.14.org/Makefile.in pdksh-5.2.14/Makefile.in ---- pdksh-5.2.14.org/Makefile.in Mon Feb 26 12:16:47 2001 -+++ pdksh-5.2.14/Makefile.in Mon Feb 26 12:19:09 2001 -@@ -16,7 +16,7 @@ - LIBS = @LIBS@ - - CPPFLAGS = @CPPFLAGS@ --CFLAGS = @CFLAGS@ -+CFLAGS = @CFLAGS@ -DDEBIAN - LDSTATIC = @LDSTATIC@ - LDFLAGS = @LDFLAGS@ - -diff -urN pdksh-5.2.14.org/alloc.c pdksh-5.2.14/alloc.c ---- pdksh-5.2.14.org/alloc.c Mon Feb 26 12:16:47 2001 -+++ pdksh-5.2.14/alloc.c Mon Feb 26 12:17:11 2001 -@@ -110,6 +110,13 @@ +--- 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 */ @@ -27,10 +20,194 @@ }; struct Block { -diff -urN pdksh-5.2.14.org/c_ksh.c pdksh-5.2.14/c_ksh.c ---- pdksh-5.2.14.org/c_ksh.c Mon Feb 26 12:16:47 2001 -+++ pdksh-5.2.14/c_ksh.c Mon Feb 26 12:17:11 2001 -@@ -1208,6 +1208,7 @@ +@@ -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 */ + + #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; + } + 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; + } + +@@ -1208,6 +1209,7 @@ builtin_opt.optarg); return 1; } @@ -38,9 +215,218 @@ case '?': return 1; } -diff -urN pdksh-5.2.14.org/edit.c pdksh-5.2.14/edit.c ---- pdksh-5.2.14.org/edit.c Mon Feb 26 12:16:47 2001 -+++ pdksh-5.2.14/edit.c Mon Feb 26 12:17:11 2001 +--- 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; + + if (ksh_getopt(wp, &builtin_opt, null) == '?') + return 1; +@@ -455,8 +456,12 @@ + */ + exstat = subst_exstat; + } +- +- 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; ) + ; + } ++#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; + +- /* ++ /* + * 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 @@ + } + #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; + + if (stat(path, &statb) < 0) +@@ -469,13 +471,7 @@ + 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); ++ } + + 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; ++ } ++ } ++#endif + if (how & SOFT) + val = limit.rlim_cur; + else if (how & HARD) +@@ -225,11 +239,17 @@ + if (how & HARD) + limit.rlim_max = val; + if (setrlimit(l->scmd, &limit) < 0) { +- if (errno == EPERM) ++ if (errno == EPERM) { + bi_errorf("exceeds allowable limit"); +- else ++#ifdef RLIMIT_LOCKS ++ } else if ( ( errno == EINVAL ) && ++ ( l->scmd == RLIMIT_LOCKS ) ) { ++ bi_errorf("unable to set it on the current kernel"); ++#endif ++ } else { + bi_errorf("bad limit: %s", + strerror(errno)); ++ } + return 1; + } + } else { +--- pdksh-5.2.14.orig/edit.c ++++ pdksh-5.2.14/edit.c @@ -15,6 +15,9 @@ # include <sys/stream.h> /* needed for <sys/ptem.h> */ # include <sys/ptem.h> /* needed for struct winsize */ @@ -86,7 +472,20 @@ /* * Convert "foo*" (toglob) to an array of strings (words) */ -@@ -766,11 +789,23 @@ +@@ -722,7 +745,12 @@ + return nwords; + } + ++#ifndef DEBIAN + #define IS_WORDC(c) !(ctype(c, C_LEX1) || (c) == '\'' || (c) == '"') ++#else /* patch from OpenBSD */ ++#define IS_WORDC(c) !( ctype(c, C_LEX1) || (c) == '\'' || (c) == '"' \ ++ || (c) == '`' || (c) == '=' || (c) == ':' ) ++#endif + + static int + x_locate_word(buf, buflen, pos, startp, is_commandp) +@@ -747,11 +775,23 @@ /* Keep going backwards to start of word (has effect of allowing * one blank after the end of a word) */ @@ -103,14 +502,60 @@ ; +#else /* DEBIAN */ /* patch from OpenBSD */ + for (end = start; end < buflen && IS_WORDC(buf[end]); end++) { -+ if (buf[end] == '\\' && (end+1) < buflen && buf[end+1] == ' ') ++ if (buf[end] == '\\' && (end+1) < buflen) + end++; + } +#endif /* DEBIAN */ if (is_commandp) { int iscmd; -@@ -1037,4 +1072,42 @@ +@@ -759,7 +799,11 @@ + /* Figure out if this is a command */ + for (p = start - 1; p >= 0 && isspace(buf[p]); p--) + ; ++#ifndef DEBIAN + iscmd = p < 0 || strchr(";|&()", buf[p]); ++#else /* DEBIAN */ /* patch from OpenBSD */ ++ iscmd = p < 0 || strchr(";|&()`", buf[p]); ++#endif + if (iscmd) { + /* If command has a /, path, etc. is not searched; + * only current directory is searched, which is just +@@ -961,6 +1005,9 @@ + { + const char *sp, *p; + char *xp; ++#ifdef DEBIAN /* patch from OpenBSD */ ++ int staterr; ++#endif /* DEBIAN */ + int pathlen; + int patlen; + int oldsize, newsize, i, j; +@@ -995,13 +1042,23 @@ + memcpy(xp, pat, patlen); + + oldsize = XPsize(*wp); ++#ifndef DEBIAN + glob_str(Xstring(xs, xp), wp, 0); ++#else /* DEBIAN */ /* patch from OpenBSD */ ++ glob_str(Xstring(xs, xp), wp, 1); /* mark dirs */ ++#endif + newsize = XPsize(*wp); + + /* Check that each match is executable... */ + words = (char **) XPptrv(*wp); + for (i = j = oldsize; i < newsize; i++) { ++#ifndef DEBIAN + if (search_access(words[i], X_OK, (int *) 0) >= 0) { ++#else /* DEBIAN */ /* patch from OpenBSD */ ++ staterr = 0; ++ if ((search_access(words[i], X_OK, &staterr) >= 0) ++ || (staterr == EISDIR)) { ++#endif + words[j] = words[i]; + if (!(flags & XCF_FULLPATH)) + memmove(words[j], words[j] + pathlen, +@@ -1018,4 +1075,42 @@ Xfree(xs, xp); } @@ -131,7 +576,7 @@ + int rval=0; + + for (add = 0, wlen = len; wlen - add > 0; add++) { -+ if (strchr("\\$(){}*&;|<>\"'", s[add]) || strchr(ifs, s[add])) { ++ if (strchr("\\$(){}*&;#|<>\"'`", s[add]) || strchr(ifs, s[add])) { + if (putbuf_func(s, add) != 0) { + rval = -1; + break; @@ -153,9 +598,8 @@ +} +#endif /* DEBIAN */ #endif /* EDIT */ -diff -urN pdksh-5.2.14.org/edit.h pdksh-5.2.14/edit.h ---- pdksh-5.2.14.org/edit.h Mon Feb 26 12:16:47 2001 -+++ pdksh-5.2.14/edit.h Mon Feb 26 12:17:11 2001 +--- pdksh-5.2.14.orig/edit.h ++++ pdksh-5.2.14/edit.h @@ -55,6 +55,9 @@ int x_longest_prefix ARGS((int nwords, char *const *words)); int x_basename ARGS((const char *s, const char *se)); @@ -166,9 +610,8 @@ /* emacs.c */ int x_emacs ARGS((char *buf, size_t len)); void x_init_emacs ARGS((void)); -diff -urN pdksh-5.2.14.org/emacs.c pdksh-5.2.14/emacs.c ---- pdksh-5.2.14.org/emacs.c Mon Feb 26 12:16:47 2001 -+++ pdksh-5.2.14/emacs.c Mon Feb 26 12:17:11 2001 +--- pdksh-5.2.14.orig/emacs.c ++++ pdksh-5.2.14/emacs.c @@ -138,6 +138,10 @@ static int x_e_getc ARGS((void)); static void x_e_putc ARGS((int c)); @@ -185,7 +628,7 @@ #endif { XFUNC_complete, 1, CTRL('[') }, +#ifdef DEBIAN /* patch from OpenBSD */ -+ { XFUNC_complete, 0, CTRL('I') }, ++ { XFUNC_comp_list, 0, CTRL('I') }, +#endif /* DEBIAN */ { XFUNC_comp_list, 1, '=' }, { XFUNC_enumerate, 1, '?' }, @@ -224,6 +667,18 @@ static int x_del_back(c) int c; +@@ -856,9 +883,9 @@ + } + x_histp = hp; + oldsize = x_size_str(xbuf); +- (void)strcpy(xbuf, *hp); ++ (void)strncpy(xbuf, *hp, xend - xbuf - 1); + xbp = xbuf; +- xep = xcp = xbuf + strlen(*hp); ++ xep = xcp = xbuf + strlen(xbuf); + xlp_valid = FALSE; + if (xep > x_lastcp()) <<Diff was trimmed, longer than 597 lines>> ---- CVS-web: http://cvs.pld-linux.org/SOURCES/pdksh-debian.patch?r1=1.3&r2=1.4&f=u _______________________________________________ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit