SOURCES: dash-debian.patch (NEW) - new

arekm arekm at pld-linux.org
Thu May 8 09:29:20 CEST 2008


Author: arekm                        Date: Thu May  8 07:29:20 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- new

---- Files affected:
SOURCES:
   dash-debian.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/dash-debian.patch
diff -u /dev/null SOURCES/dash-debian.patch:1.1
--- /dev/null	Thu May  8 09:29:20 2008
+++ SOURCES/dash-debian.patch	Thu May  8 09:29:15 2008
@@ -0,0 +1,13625 @@
+From c5ac5b73ace64323a75423e7c1b7b2a0be71a156 Mon Sep 17 00:00:00 2001
+From: Herbert Xu <herbert at gondor.apana.org.au>
+Date: Sat, 22 Sep 2007 20:49:42 +0800
+Subject: [PATCH] [SHELL] Restore foreground process group on exit
+
+On Thu, Jun 07, 2007 at 12:20:27PM +0200, Denis Vlasenko wrote:
+>
+> When I start dash under Midnight Commander and then type 'exit', dash
+> exits all right, but then MC is sent to background. It happens because
+> dash does not restore current process group on exit.
+>
+> Attached patch fixes this. It also fixes another bug: setjobctl(0)
+> must ignore tcsetpgrp errors, because there are cases when tty is
+> destroyed under dash.
+>
+> Patch is run-tested.
+
+I've fixed this slightly differently so that we don't need the
+xtcsetpgrp change.
+---
+ ChangeLog  |    4 ++++
+ src/trap.c |    8 +++++++-
+ 2 files changed, 11 insertions(+), 1 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 6ce16c6..295fa66 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2007-09-21  Denis Vlasenko <vda.linux at googlemail.com>
++
++	* Restore foreground process group on exit.
++
+ 2007-07-12  Herbert Xu <herbert at gondor.apana.org.au>
+ 
+ 	* Release 0.5.4.
+diff --git a/src/trap.c b/src/trap.c
+index eae6186..c386db7 100644
+--- a/src/trap.c
++++ b/src/trap.c
+@@ -357,7 +357,7 @@ exitshell(void)
+ 	TRACE(("pid %d, exitshell(%d)\n", getpid(), status));
+ 	if (setjmp(loc.loc)) {
+ 		if (exception == EXEXIT)
+-			_exit(exitstatus);
++			status = exitstatus;
+ 		goto out;
+ 	}
+ 	handler = &loc;
+@@ -367,6 +367,12 @@ exitshell(void)
+ 	}
+ 	flushall();
+ out:
++	/*
++	 * Disable job control so that whoever had the foreground before we
++	 * started can get it back.
++	 */
++	if (likely(!setjmp(loc.loc)))
++		setjobctl(0);
+ 	_exit(status);
+ 	/* NOTREACHED */
+ }
+-- 
+1.5.5
+
+From 553f85288bb1cdacfa482f351af26cc924ccb386 Mon Sep 17 00:00:00 2001
+From: Herbert Xu <herbert at gondor.apana.org.au>
+Date: Sat, 22 Sep 2007 20:50:21 +0800
+Subject: [PATCH] [SHELL] Move flushall to the point just before _exit
+
+We need to flush at the very end in case we've generated any errors
+before that.  The flushall call cannot perform a longjmp so it's
+safe there.
+---
+ ChangeLog  |    4 ++++
+ src/trap.c |    2 +-
+ 2 files changed, 5 insertions(+), 1 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 295fa66..ba974ca 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2007-09-22  Herbert Xu <herbert at gondor.apana.org.au>
++
++	* Move flushall to the point just before _exit.
++
+ 2007-09-21  Denis Vlasenko <vda.linux at googlemail.com>
+ 
+ 	* Restore foreground process group on exit.
+diff --git a/src/trap.c b/src/trap.c
+index c386db7..58cd0cc 100644
+--- a/src/trap.c
++++ b/src/trap.c
+@@ -365,7 +365,6 @@ exitshell(void)
+ 		trap[0] = NULL;
+ 		evalstring(p, 0);
+ 	}
+-	flushall();
+ out:
+ 	/*
+ 	 * Disable job control so that whoever had the foreground before we
+@@ -373,6 +372,7 @@ out:
+ 	 */
+ 	if (likely(!setjmp(loc.loc)))
+ 		setjobctl(0);
++	flushall();
+ 	_exit(status);
+ 	/* NOTREACHED */
+ }
+-- 
+1.5.5
+
+From cd8b7aebb095f82a574b2863bd82f3333d215042 Mon Sep 17 00:00:00 2001
+From: Oleg Verych <olecom at flower.upol.cz>
+Date: Sat, 22 Sep 2007 21:08:32 +0800
+Subject: [PATCH] [BUILTIN] test: White space fixes
+
+Some trailing whitespace was killed or tabified.
+---
+ ChangeLog        |    4 ++++
+ src/bltin/test.c |   14 +++++++-------
+ 2 files changed, 11 insertions(+), 7 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index ba974ca..5804248 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2007-09-22  Oleg Verych <olecom at flower.upol.cz>
++
++	* White space fixes for test(1).
++
+ 2007-09-22  Herbert Xu <herbert at gondor.apana.org.au>
+ 
+ 	* Move flushall to the point just before _exit.
+diff --git a/src/bltin/test.c b/src/bltin/test.c
+index f16c819..fd24fae 100644
+--- a/src/bltin/test.c
++++ b/src/bltin/test.c
+@@ -250,7 +250,7 @@ primary(enum token n)
+ 
+ 	if (t_lex(t_wp[1]), t_wp_op && t_wp_op->op_type == BINOP) {
+ 		return binop();
+-	}	  
++	}
+ 
+ 	return strlen(*t_wp) > 0;
+ }
+@@ -267,7 +267,7 @@ binop(void)
+ 
+ 	if ((opnd2 = *++t_wp) == (char *)0)
+ 		syntax(op->op_text, "argument expected");
+-		
++
+ 	switch (op->op_num) {
+ 	default:
+ #ifdef DEBUG
+@@ -389,8 +389,8 @@ isoperand(void)
+ 		return 0;
+ 	while (op->op_text) {
+ 		if (strcmp(s, op->op_text) == 0)
+-	    		return op->op_type == BINOP &&
+-	    		    (t[0] != ')' || t[1] != '\0'); 
++			return op->op_type == BINOP &&
++			    (t[0] != ')' || t[1] != '\0');
+ 		op++;
+ 	}
+ 	return 0;
+@@ -407,13 +407,13 @@ getn(const char *s)
+ 	r = strtol(s, &p, 10);
+ 
+ 	if (errno != 0)
+-	      error("%s: out of range", s);
++		error("%s: out of range", s);
+ 
+ 	while (isspace((unsigned char)*p))
+ 	      p++;
+-	
++
+ 	if (*p)
+-	      error("%s: bad number", s);
++		error("%s: bad number", s);
+ 
+ 	return (int) r;
+ }
+-- 
+1.5.5
+
+From cd212af1d362b0466f1f2767252424446c0fbaa5 Mon Sep 17 00:00:00 2001
+From: Oleg Verych <olecom at flower.upol.cz>
+Date: Sat, 22 Sep 2007 21:19:37 +0800
+Subject: [PATCH] [BUILTIN] test: little size and speed optimizations
+
+* Speed up (libc=glibc):
+
+deen:debian/src/dash-0.5.3# echo $(((7853+8631+7529+9777+9161+7552)/6))
+8417,8250 # this patch
+deen:/mnt/work/debian/src/dash-0.5.3# echo $(((9553+7789+9450+9925+7595+9590)/6))
+8983 # short
+deen:debian/src/dash-0.5.3# echo $(( (9655+7853+9733+7826+9618+10053)/6 ))
+9123 # '[' ']'
+deen:debian/src/dash-0.5.3#
+
+deen:debian/src/dash-0.5.3# echo $(((9231+9423+9365+9650+8883+8291)/6))
+9140 # unpatched
+deen:debian/src/dash-0.5.3#
+
+* Size down:
+
+olecom at deen:/mnt/debian/src/dash-0.5.3$ size src/test.o # this patchset
+   text    data     bss     dec     hex filename
+   4142       0      16    4158    103e src/test.o
+
+olecom at deen:/mnt/debian/src/dash-0.5.3$ size src/test.o
+   text    data     bss     dec     hex filename
+   4209       0      16    4225    1081 src/test.o
+olecom at deen:/mnt/debian/src/dash-0.5.3$
+---
+ ChangeLog        |    1 +
+ src/bltin/test.c |    4 ++--
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 5804248..b22197f 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,6 +1,7 @@
+ 2007-09-22  Oleg Verych <olecom at flower.upol.cz>
+ 
+ 	* White space fixes for test(1).
++	* Use direct comparison instead of strcmp in test(1).
+ 
+ 2007-09-22  Herbert Xu <herbert at gondor.apana.org.au>
+ 
+diff --git a/src/bltin/test.c b/src/bltin/test.c
+index fd24fae..7d49569 100644
+--- a/src/bltin/test.c
++++ b/src/bltin/test.c
+@@ -157,8 +157,8 @@ testcmd(int argc, char **argv)
+ {
+ 	int res;
+ 
+-	if (strcmp(argv[0], "[") == 0) {
+-		if (strcmp(argv[--argc], "]"))
++	if (*argv[0] == '[') {
++		if (*argv[--argc] != ']')
+ 			error("missing ]");
+ 		argv[argc] = NULL;
+ 	}
+-- 
+1.5.5
+
+From 9b568fedfdc4ec56e52ded4c3a1a135d24c8d75b Mon Sep 17 00:00:00 2001
+From: Herbert Xu <herbert at gondor.apana.org.au>
+Date: Mon, 24 Sep 2007 16:17:20 +0800
+Subject: [PATCH] [EXPAND] Do not quote back slashes in parameter expansions outside quotes
+
+Test case:
+
+	a=/b/c/*
+	b=\\
+	echo ${a%$b*}
+
+Old result:
+
+	/b/c/*
+
+New result:
+
+	/b/c/
+---
+ ChangeLog      |    4 ++++
+ src/expand.c   |    5 ++---
+ src/mksyntax.c |    5 +++--
+ src/parser.c   |    4 +++-
+ 4 files changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index b22197f..dca08d5 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2007-09-24  Herbert Xu <herbert at gondor.apana.org.au>
++
++	* Do not quote back slashes in parameter expansions outside quotes.
++
+ 2007-09-22  Oleg Verych <olecom at flower.upol.cz>
+ 
+ 	* White space fixes for test(1).
+diff --git a/src/expand.c b/src/expand.c
+index db67c7c..3956112 100644
+--- a/src/expand.c
++++ b/src/expand.c
+@@ -895,7 +895,7 @@ memtodest(const char *p, size_t len, const char *syntax, int quotes) {
+ 		int c = (signed char)*p++;
+ 		if (c) {
+ 			if ((quotes & QUOTES_ESC) &&
+-			    (syntax[c] == CCTL || syntax[c] == CBACK))
++			    (syntax[c] == CCTL || syntax[c] == CDBACK))
+ 				USTPUTC(CTLESC, q);
+ 		} else if (!(quotes & QUOTES_KEEPNUL))
+ 			continue;
+@@ -1671,9 +1671,8 @@ _rmescapes(char *str, int flag)
+ 		}
+ 		if (*p == (char)CTLESC) {
+ 			p++;
+-			if (notescaped && inquotes && *p != '/') {
++			if (notescaped && inquotes)
+ 				*q++ = '\\';
+-			}
+ 		}
+ 		notescaped = globbing;
+ copy:
+diff --git a/src/mksyntax.c b/src/mksyntax.c
+index 7a8a9ae..9ecbb45 100644
+--- a/src/mksyntax.c
++++ b/src/mksyntax.c
+@@ -53,6 +53,7 @@ struct synclass synclass[] = {
+ 	{ "CWORD",	"character is nothing special" },
+ 	{ "CNL",	"newline character" },
+ 	{ "CBACK",	"a backslash character" },
++	{ "CDBACK",	"a backslash character in double quotes" },
+ 	{ "CSQUOTE",	"single quote" },
+ 	{ "CDQUOTE",	"double quote" },
+ 	{ "CENDQUOTE",	"a terminating quote" },
+@@ -175,7 +176,7 @@ main(int argc, char **argv)
+ 	init();
+ 	fputs("\n/* syntax table used when in double quotes */\n", cfile);
+ 	add("\n", "CNL");
+-	add("\\", "CBACK");
++	add("\\", "CDBACK");
+ 	add("\"", "CENDQUOTE");
+ 	add("`", "CBQUOTE");
+ 	add("$", "CVAR");
+@@ -193,7 +194,7 @@ main(int argc, char **argv)
+ 	init();
+ 	fputs("\n/* syntax table used when in arithmetic */\n", cfile);
+ 	add("\n", "CNL");
+-	add("\\", "CBACK");
++	add("\\", "CDBACK");
+ 	add("`", "CBQUOTE");
+ 	add("$", "CVAR");
+ 	add("}", "CENDVAR");
+diff --git a/src/parser.c b/src/parser.c
+index 6faff17..279d49e 100644
+--- a/src/parser.c
++++ b/src/parser.c
+@@ -891,7 +891,9 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
+ 					USTPUTC(CTLESC, out);
+ 				USTPUTC(c, out);
+ 				break;
+-			case CBACK:	/* backslash */
++			/* backslash */
++			case CBACK:
++			case CDBACK:
+ 				c = pgetc2();
+ 				if (c == PEOF) {
+ 					USTPUTC(CTLESC, out);
+-- 
+1.5.5
+
+From 82c20d9ca645ea33cbc500ad3da3b1c8d430322d Mon Sep 17 00:00:00 2001
+From: Herbert Xu <herbert at gondor.apana.org.au>
+Date: Mon, 24 Sep 2007 16:22:25 +0800
+Subject: [PATCH] [EXPAND] Perform tilde expansion in all parameter expansion words
+
+Previously tilde expansion was not carried out for =?#% expansion words.
+This is contrary to the POSIX specification.
+
+Test case:
+
+	a=~root:~root
+	echo ${a#~root}
+
+Old result:
+
+	/root:/root
+
+New result:
+
+	:/root
+---
+ ChangeLog    |    1 +
+ src/expand.c |    3 ++-
+ 2 files changed, 3 insertions(+), 1 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index dca08d5..816f56d 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,6 +1,7 @@
+ 2007-09-24  Herbert Xu <herbert at gondor.apana.org.au>
+ 
+ 	* Do not quote back slashes in parameter expansions outside quotes.
++	* Perform tilde expansion in all parameter expansion words.
+ 
+ 2007-09-22  Oleg Verych <olecom at flower.upol.cz>
+ 
+diff --git a/src/expand.c b/src/expand.c
+index 3956112..1443c14 100644
+--- a/src/expand.c
++++ b/src/expand.c
+@@ -683,7 +683,8 @@ subevalvar(char *p, char *str, int strloc, int subtype, int startloc, int varfla
+ 	char *(*scan)(char *, char *, char *, char *, int , int);
+ 
+ 	herefd = -1;
+-	argstr(p, subtype != VSASSIGN && subtype != VSQUESTION ? EXP_CASE : 0);
++	argstr(p, EXP_TILDE | (subtype != VSASSIGN && subtype != VSQUESTION ?
++			       EXP_CASE : 0));
+ 	STPUTC('\0', expdest);
+ 	herefd = saveherefd;
+ 	argbackq = saveargbackq;
+-- 
+1.5.5
+
+From 08ee0731cd65a502f34718c2ac11c266daeb4c5b Mon Sep 17 00:00:00 2001
+From: Herbert Xu <herbert at gondor.apana.org.au>
+Date: Mon, 24 Sep 2007 21:53:49 +0800
+Subject: [PATCH] [PARSER] Remove superfluous arinest test in CENDQUOTE
+
+If arinest is set then the syntax must be ARISYNTAX.  As such CENDQUOTE can
+never occur while arinest is set so we don't need to test for it.
+---
+ ChangeLog    |    1 +
+ src/parser.c |    5 ++---
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 816f56d..0a35741 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -2,6 +2,7 @@
+ 
+ 	* Do not quote back slashes in parameter expansions outside quotes.
+ 	* Perform tilde expansion in all parameter expansion words.
++	* Remove superfluous arinest test in CENDQUOTE.
+ 
+ 2007-09-22  Oleg Verych <olecom at flower.upol.cz>
+ 
+diff --git a/src/parser.c b/src/parser.c
+index 279d49e..26c9046 100644
+--- a/src/parser.c
++++ b/src/parser.c
+@@ -932,10 +932,9 @@ quotemark:
+ 				dblquote = 1;
+ 				goto quotemark;
+ 			case CENDQUOTE:
+-				if (eofmark != NULL && arinest == 0 &&
+-				    varnest == 0) {
++				if (eofmark && !varnest)
+ 					USTPUTC(c, out);
+-				} else {
++				else {
+ 					if (dqvarnest == 0) {
+ 						syntax = BASESYNTAX;
+ 						dblquote = 0;
+-- 
+1.5.5
+
+From ede60fbf86edd87449585781df10e091ec420a1f Mon Sep 17 00:00:00 2001
+From: Herbert Xu <herbert at gondor.apana.org.au>
+Date: Mon, 24 Sep 2007 21:59:39 +0800
+Subject: [PATCH] [PARSER] Remove superfluous arinest test for dqvarnest
+
+dqvarnest is only used to determine whether CENDQUOTE should terminate the
+double-quote syntax.  Since CENDQUOTE can never occur while arinest is set,
+we don't need to take arinest into account for dqvarnest.
+---
+ ChangeLog    |    1 +
+ src/parser.c |    3 +--
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 0a35741..b311ad4 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -3,6 +3,7 @@
+ 	* Do not quote back slashes in parameter expansions outside quotes.
+ 	* Perform tilde expansion in all parameter expansion words.
+ 	* Remove superfluous arinest test in CENDQUOTE.
++	* Remove superfluous arinest test for dqvarnest.
+ 
+ 2007-09-22  Oleg Verych <olecom at flower.upol.cz>
+ 
+diff --git a/src/parser.c b/src/parser.c
+index 26c9046..8fac57a 100644
+--- a/src/parser.c
++++ b/src/parser.c
+@@ -1232,9 +1232,8 @@ badsub:			synerror("Bad substitution");
+ 		*((char *)stackblock() + typeloc) = subtype | flags;
+ 		if (subtype != VSNORMAL) {
+ 			varnest++;
+-			if (dblquote || arinest) {
++			if (dblquote)
+ 				dqvarnest++;
+-			}
+ 		}
+ 	}
+ 	goto parsesub_return;
+-- 
+1.5.5
+
+From b428e83766c7b9d0cb887f0dd582272c5e85a536 Mon Sep 17 00:00:00 2001
+From: Herbert Xu <herbert at gondor.apana.org.au>
+Date: Mon, 24 Sep 2007 22:11:59 +0800
+Subject: [PATCH] [PARSER] Remove superfluous dblquote settings when ending arith
+
+When an arithmetic expansion terminates and we restore the syntax to the
+previous one, we don't need to set dblquote because we never changed upon
+entering the arithmetic expansion.
+---
+ ChangeLog    |    1 +
+ src/parser.c |    4 ----
+ 2 files changed, 1 insertions(+), 4 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index b311ad4..e5987f9 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -4,6 +4,7 @@
+ 	* Perform tilde expansion in all parameter expansion words.
+ 	* Remove superfluous arinest test in CENDQUOTE.
+ 	* Remove superfluous arinest test for dqvarnest.
++	* Remove superfluous dblquote settings when ending arith.
+ 
+ 2007-09-22  Oleg Verych <olecom at flower.upol.cz>
+ 
+diff --git a/src/parser.c b/src/parser.c
+index 8fac57a..791251d 100644
+--- a/src/parser.c
++++ b/src/parser.c
+@@ -970,10 +970,6 @@ quotemark:
+ 						if (--arinest == 0) {
+ 							USTPUTC(CTLENDARI, out);
+ 							syntax = prevsyntax;
+-							if (syntax == DQSYNTAX)
+-								dblquote = 1;
+-							else
+-								dblquote = 0;
+ 						} else
+ 							USTPUTC(')', out);
+ 					} else {
+-- 
+1.5.5
+
+From f28b0328dda170028c3070c69ef38cdd8d269932 Mon Sep 17 00:00:00 2001
+From: Herbert Xu <herbert at gondor.apana.org.au>
+Date: Mon, 24 Sep 2007 22:28:49 +0800
+Subject: [PATCH] [PARSER] Remove arithmetic expansion collapsing at parse time
+
+Collapsing arithmethc expansion is incorrect when the inner arithmetic
+expansion is a part of a parameter expansion.
+
+Test case:
+
+	unset a
+	echo $((3 + ${a:=$((4 + 5))}))
+	echo $a
+
+Old result:
+
+	(4 + 5)
+
+New result:
+
+	9
+---
+ ChangeLog    |    1 +
+ src/parser.c |   22 +++++++---------------
+ 2 files changed, 8 insertions(+), 15 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index e5987f9..7992485 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -5,6 +5,7 @@
+ 	* Remove superfluous arinest test in CENDQUOTE.
+ 	* Remove superfluous arinest test for dqvarnest.
+ 	* Remove superfluous dblquote settings when ending arith.
++	* Remove arithmetic expansion collapsing at parse time.
+ 
+ 2007-09-22  Oleg Verych <olecom at flower.upol.cz>
+ 
+diff --git a/src/parser.c b/src/parser.c
+index 791251d..e00fd4b 100644
+--- a/src/parser.c
++++ b/src/parser.c
+@@ -967,11 +967,9 @@ quotemark:
+ 					--parenlevel;
+ 				} else {
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list