packages: pdksh/pdksh-debian.patch, pdksh/pdksh.spec, pdksh/pdksh-openbsd.p...

arekm arekm at pld-linux.org
Tue Jul 28 09:50:05 CEST 2009


Author: arekm                        Date: Tue Jul 28 07:50:05 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- rel 53; some openbsd fixes

---- Files affected:
packages/pdksh:
   pdksh-debian.patch (1.5 -> 1.6) , pdksh.spec (1.121 -> 1.122) , pdksh-openbsd.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/pdksh/pdksh-debian.patch
diff -u packages/pdksh/pdksh-debian.patch:1.5 packages/pdksh/pdksh-debian.patch:1.6
--- packages/pdksh/pdksh-debian.patch:1.5	Thu May  8 08:36:06 2008
+++ packages/pdksh/pdksh-debian.patch	Tue Jul 28 09:49:59 2009
@@ -1,2670 +1,2774 @@
-  * 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));
- 
- /* 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 */
- 		}
- 	}
-@@ -497,7 +503,7 @@
- 		put_job(j, PJ_PAST_STOPPED);
- 	}
- 
--	fill_command(p->command, sizeof(p->command), t);
-+	snptreef(p->command, sizeof(p->command), "%T", t);
- 
- 	/* create child process */
- 	forksleep = 1;
-@@ -508,7 +514,7 @@
- 		forksleep <<= 1;
- 	}
- 	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 @@
- 	}
- 
- 	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;
- 
- 	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);
- 	}
- 
- 	/* 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 @@
- 
- 	  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
- 			flags |= XERROK;
-+		rv_prop = 1;
- 		break;
- 
- 	  case TBANG:
-@@ -323,6 +326,7 @@
- 			}
- 		}
- 		rv = 0; /* in case of a continue */
-+		rv_prop = 1;
- 		if (t->type == TFOR) {
- 			while (*ap != NULL) {
- 				setstr(global(t->str), *ap++, KSH_UNWIND_ERROR);
-@@ -334,6 +338,7 @@
- 			for (;;) {
- 				if (!(cp = do_selectargs(ap, is_first))) {
- 					rv = 1;
-+					rv_prop = 0;
- 					break;
- 				}
- 				is_first = FALSE;
-@@ -365,6 +370,7 @@
- 		rv = 0; /* in case of a continue */
- 		while ((execute(t->left, XERROK) == 0) == (t->type == TWHILE))
- 			rv = execute(t->right, flags & XERROK);
-+		rv_prop = 1;
- 		break;
- 
- 	  case TIF:
-@@ -374,6 +380,7 @@
- 		rv = execute(t->left, XERROK) == 0 ?
- 			execute(t->right->left, flags & XERROK) :
- 			execute(t->right->right, flags & XERROK);
-+		rv_prop = 1;
- 		break;
- 
- 	  case TCASE:
-@@ -386,10 +393,12 @@
- 		break;
- 	  Found:
- 		rv = execute(t->left, flags & XERROK);
-+		rv_prop = 1;
- 		break;
- 
- 	  case TBRACE:
- 		rv = execute(t->left, flags & XERROK);
-+		rv_prop = 1;
- 		break;
- 
- 	  case TFUNCT:
-@@ -401,6 +410,7 @@
- 		 * (allows "ls -l | time grep foo").
- 		 */
- 		rv = timex(t, flags & ~XEXEC);
-+		rv_prop = 1;
- 		break;
- 
- 	  case TEXEC:		/* an eval'd TCOM */
-@@ -428,7 +438,7 @@
- 	quitenv();		/* restores IO */
- 	if ((flags&XEXEC))
- 		unwind(LEXIT);	/* exit child */
--	if (rv != 0 && !(flags & XERROK)) {
-+	if (rv != 0 && !rv_prop && !(flags & XERROK)) {
- 		if (Flag(FERREXIT))
- 			unwind(LERROR);
- 		trapsig(SIGERR_);
-  * Applied some patches from OpenBSD:
-    + Use mkstemp to create temporary files	
-    + Kill -s now works
-    + Escapes special characters in tab completitions
-    + Introduce FSH flag, which is set when the shell is called as `sh'.
-    + tree.c: Fix three off-by-one errors.
-    + c_sh.c: don't set close-on-exec flag on file descriptors in FSH mode
-      (closes: #154540). Documented the change in ksh(1).
-    + history.c: Compare the return from mmap with MAP_FAILED, do not cast it
-      to int and compare with -1.
-    + main.c: set edit mode to emacs by default, may be overridden by the
-      environment or the user.  Also, we want tab completion in vi by default.
-    + misc.c: use strtol() in getn().
-    + emacs.c:
-       - bind TAB (^I) to complete-list by default
-       - complete-list first completes; if that does not work, it lists
-       - fix a memleak in do_complete()
-    + edit.c:
-       - completion now works after '=' (dd), and ':' (ssh) and ` (backtick)
-       - add '#' to the list of escaped characters during vi/emacs filename
-         completion
-
-    + exec.c: Found and fixed yet another problem with `set -e' scripts
-      (see a changelog entry for 5.2.14-3), which caused `dpkg-buildpackage -B'
-      to fail on systems where /bin/sh is ksh.
-  
-    + c_sh.c: Make `set' command return 0 always, not only in the POSIX mode.
-      According to Jeff Sheinberg <jeffsh at localnet.com>, this new behaviour
-      is more compatible with SUSv2 standard and other shells (esp. ksh93)
-      (closes: #118476). Documented the change in ksh(1) man page.
-
-    + c_test.c: The special case code for "test -x" over NFS was
-      incorrect.  The right thing to do is to try access(2) first
-      (since that occurs on the NFS server side) and only check for the
-      absence of an execute bit when access(2) succeeds.
-    + edit.c: in word location, fix forward scanning so it correctly
-      account for any escaped char and not only spaces.  for "foo
-      (bar.a)" and "foo (bar a)", cd foo\ \(bar.<tab> will correctly
-      expand to foo\ \(bar.a\).
-
-    + vi.c: Buffers are not strings so use memcpy(), not strlcpy() to copy
-      them. Also add some further bounds checks in the name of paranoia.
-    + exec.c: Unbreak parameter assignment when calling bourne style
-      functions.
-    + exec.c: For the >& and <& operators, add a check for "dup from" ==
-      "dup to" and just return success if they are the same.  Fixes the
-      "ls 2>&2" problem.
-    + eval.c, exec.c, io.c, jobs.c: If "from fd" == "to fd" don't call
-      dup2() or close "from fd".
-     
-Index: pdksh/c_ksh.c
-===================================================================
---- pdksh.orig/c_ksh.c	2008-04-15 20:46:56.000000000 +0200
-+++ pdksh/c_ksh.c	2008-04-15 20:49:47.000000000 +0200
-@@ -1208,6 +1208,7 @@
- 						builtin_opt.optarg);
- 					return 1;
- 				}
-+				break;		
- 			  case '?':
- 				return 1;
- 			}
-Index: pdksh/edit.c
-===================================================================
---- pdksh.orig/edit.c	2008-04-15 20:46:56.000000000 +0200
-+++ pdksh/edit.c	2008-04-15 20:49:47.000000000 +0200
-@@ -15,6 +15,9 @@
- # include <sys/stream.h>	/* needed for <sys/ptem.h> */
- # include <sys/ptem.h>		/* needed for struct winsize */
- #endif /* OS_SCO */
-+#ifdef DEBIAN
-+#include <sys/ioctl.h>
-+#endif /* DEBIAN */
- #include <ctype.h>
- #include "ksh_stat.h"
- 
-@@ -552,7 +555,11 @@
- {
- 	char *toglob;
- 	char **words;
-+#ifndef DEBIAN 
- 	int nwords;
-+#else /* DEBIAN */ /* patch from OpenBSD */ 
-+	int nwords, i, idx, escaping;
-+#endif /* DEBIAN */
- 	XPtrV w;
- 	struct source *s, *sold;
- 
-@@ -561,6 +568,22 @@
- 
- 	toglob = add_glob(str, slen);
- 
-+#ifdef DEBIAN /* patch from OpenBSD */
-+	/* remove all escaping backward slashes */
-+	escaping = 0;
-+	for(i = 0, idx = 0; toglob[i]; i++) {
-+		if (toglob[i] == '\\' && !escaping) {
-+			escaping = 1;
-+			continue;
-+		}
-+
-+		toglob[idx] = toglob[i];
-+		idx++;
-+		if (escaping) escaping = 0;
-+	}
-+	toglob[idx] = '\0';
-+
-+#endif /* DEBIAN */
- 	/*
- 	 * Convert "foo*" (toglob) to an array of strings (words)
- 	 */
-@@ -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)
- 	 */
-+#ifndef DEBIAN
- 	for (; start > 0 && IS_WORDC(buf[start - 1]); start--)
-+#else /* DEBIAN */ /* patch from OpenBSD */ 
-+	for (; (start > 0 && IS_WORDC(buf[start - 1]))
-+		|| (start > 1 && buf[start-2] == '\\'); start--)
-+#endif /* DEBIAN */
- 		;
- 	/* Go forwards to end of word */
-+#ifndef DEBIAN
- 	for (end = start; end < buflen && IS_WORDC(buf[end]); end++)
- 		;
-+#else /* DEBIAN */ /* patch from OpenBSD */ 
-+	for (end = start; end < buflen && IS_WORDC(buf[end]); end++) {
-+		if (buf[end] == '\\' && (end+1) < buflen)
-+			end++;
-+	}
-+#endif /* DEBIAN */
- 
- 	if (is_commandp) {
- 		int iscmd;
-@@ -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);
- }
- 
-+#ifdef DEBIAN /* patch from OpenBSD */  
-+/*
-+ * if argument string contains any special characters, they will
-+ * be escaped and the result will be put into edit buffer by
-+ * keybinding-specific function
-+ */
-+int
-+x_escape(s, len, putbuf_func)
-+	const char *s;
-+	size_t len;
-+	int putbuf_func ARGS((const char *s, size_t len));
-+{
-+	size_t add, wlen;
-+	const char *ifs = str_val(local("IFS", 0));
-+	int rval=0;
-+
-+	for (add = 0, wlen = len; wlen - add > 0; add++) {
-+		if (strchr("\\$(){}*&;#|<>\"'`", s[add]) || strchr(ifs, s[add])) {
-+			if (putbuf_func(s, add) != 0) {
-+				rval = -1;
-+				break;
-+			}
-+
-+			putbuf_func("\\", 1);
-+			putbuf_func(&s[add], 1);
-+
-+			add++;
-+			wlen -= add;
-+			s += add;
-+			add = -1; /* after the increment it will go to 0 */
-+		}
-+	}
-+	if (wlen > 0 && rval == 0)
-+		rval = putbuf_func(s, wlen);
-+
-+	return (rval);
-+}
-+#endif /* DEBIAN */
- #endif /* EDIT */
-Index: pdksh/edit.h
-===================================================================
---- pdksh.orig/edit.h	2008-04-15 20:46:56.000000000 +0200
-+++ pdksh/edit.h	2008-04-15 20:49:47.000000000 +0200
-@@ -55,6 +55,9 @@
- int	x_longest_prefix ARGS((int nwords, char *const *words));
- int	x_basename ARGS((const char *s, const char *se));
- void	x_free_words ARGS((int nwords, char **words));
-+#ifdef DEBIAN /* patch from OpenBSD */ 
-+int	x_escape ARGS((const char *, size_t, int (*)(const char *s, size_t len)));
-+#endif /* DEBIAN */
- /* emacs.c */
- int 	x_emacs		ARGS((char *buf, size_t len));
- void 	x_init_emacs	ARGS((void));
-Index: pdksh/emacs.c
-===================================================================
---- pdksh.orig/emacs.c	2008-04-15 20:46:56.000000000 +0200
-+++ pdksh/emacs.c	2008-04-15 20:49:47.000000000 +0200
-@@ -138,6 +138,10 @@
- static int	x_e_getc    ARGS((void));
- static void	x_e_putc    ARGS((int c));
- static void	x_e_puts    ARGS((const char *s));
-+#ifdef DEBIAN /* patch from OpenBSD */ 
-+static int	x_comment   ARGS((int c));
-+static int	x_emacs_putbuf	ARGS((const char *s, size_t len));
-+#endif /* DEBIAN */
- static int	x_fold_case ARGS((int c));
- static char	*x_lastcp ARGS((void));
- static void	do_complete ARGS((int flags, Comp_type type));
-@@ -269,6 +273,9 @@
- 	{ XFUNC_transpose,		0, CTRL('T') },
- #endif
- 	{ XFUNC_complete,		1, CTRL('[') },
-+#ifdef DEBIAN /* patch from OpenBSD */ 
-+	{ XFUNC_comp_list,		0, CTRL('I') },
-+#endif /* DEBIAN */
-         { XFUNC_comp_list,		1,	'='  },
- 	{ XFUNC_enumerate,		1,	'?'  },
-         { XFUNC_expand,			1,	'*'  },
-@@ -313,6 +320,9 @@
- 	 * entries.
- 	 */
-         { XFUNC_meta2,			1,	'['  },
-+#ifdef DEBIAN  /* patch from OpenBSD */ 
-+        { XFUNC_meta2,			1,	'O'  },
-+#endif /* DEBIAN */
- 	{ XFUNC_prev_com,		2,	'A'  },
- 	{ XFUNC_next_com,		2,	'B'  },
- 	{ XFUNC_mv_forw,		2,	'C'  },
-@@ -468,6 +478,23 @@
- 	return 0;
- }
- 
-+#ifdef DEBIAN  /* patch from OpenBSD */ 
-+/*
-+ * this is used for x_escape() in do_complete()
-+ */
-+static int
-+x_emacs_putbuf(s, len)
-+	const char *s;
-+	size_t len;
-+{
-+	int rval;
-+
-+	if ((rval = x_do_ins(s, len)) != 0)
-+		return (rval);
-+	return (rval);
-+}
-+
-+#endif /* DEBIAN */
- static int
- x_del_back(c)
- 	int c;
-@@ -1485,7 +1512,11 @@
- 		for (j = 0; j < X_TABSZ; j++)
- 			x_tab[i][j] = XFUNC_error;
- 	for (i = 0; i < NELEM(x_defbindings); i++)
-+#ifndef DEBIAN
- 		x_tab[x_defbindings[i].xdb_tab][x_defbindings[i].xdb_char]
-+#else /* DEBIAN */ /* patch from OpenBSD */ 
-+		x_tab[(unsigned char)x_defbindings[i].xdb_tab][x_defbindings[i].xdb_char]
-+#endif /* DEBIAN */
- 			= x_defbindings[i].xdb_func;
- 
- 	x_atab = (char *(*)[X_TABSZ]) alloc(sizeofN(*x_atab, X_NTABS), AEDIT);
-@@ -1754,6 +1785,7 @@
- 	int flags;	/* XCF_{COMMAND,FILE,COMMAND_FILE} */
- 	Comp_type type;
- {
-+#ifndef DEBIAN
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/pdksh/pdksh-debian.patch?r1=1.5&r2=1.6&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/pdksh/pdksh.spec?r1=1.121&r2=1.122&f=u



More information about the pld-cvs-commit mailing list