svn commit: trunk/busybox/shell

vda at busybox.net vda at busybox.net
Wed Jun 18 19:22:21 UTC 2008


Author: vda
Date: 2008-06-18 12:22:19 -0700 (Wed, 18 Jun 2008)
New Revision: 22441

Log:
ash: fix "shift BIGNUM" and "read with no variable name" bugs.
 omg. hush testsuite helps to find bugs in ash! what next?

function                                             old     new   delta
static.arg_REPLY                                       -       8      +8
readcmd                                             1023    1021      -2
shiftcmd                                             129     125      -4
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 8/-6)                Total: 2 bytes



Modified:
   trunk/busybox/shell/ash.c


Changeset:
Modified: trunk/busybox/shell/ash.c
===================================================================
--- trunk/busybox/shell/ash.c	2008-06-18 17:53:57 UTC (rev 22440)
+++ trunk/busybox/shell/ash.c	2008-06-18 19:22:19 UTC (rev 22441)
@@ -9549,7 +9549,7 @@
 	if (argv[1])
 		n = number(argv[1]);
 	if (n > shellparam.nparam)
-		ash_msg_and_raise_error("can't shift that many");
+		n = shellparam.nparam;
 	INT_OFF;
 	shellparam.nparam -= n;
 	for (ap1 = shellparam.p; --n >= 0; ap1++) {
@@ -11994,6 +11994,8 @@
 static int
 readcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
 {
+	static const char *const arg_REPLY[] = { "REPLY", NULL };
+
 	char **ap;
 	int backslash;
 	char c;
@@ -12086,7 +12088,7 @@
 	}
 	ap = argptr;
 	if (*ap == NULL)
-		ash_msg_and_raise_error("arg count");
+		ap = (char**)arg_REPLY;
 	ifs = bltinlookup("IFS");
 	if (ifs == NULL)
 		ifs = defifs;




More information about the busybox-cvs mailing list