[BusyBox] Strange things/Error with bb ash again and again ;-)

Vladimir N. Oleynik dzo at simtreas.ru
Fri Sep 7 05:17:26 UTC 2001


Arne,

Erik has taken ash from very old minix where by all means wanted to receive 64k
a code. 
I can by comparison of debug log runing ash from minix 2.0 and ash busybox CVS
to find 
a difference, having killed on it a floor of day. 
But really you want from ash to receive bash? 
Particularly for this problem patch in the attach.  

> yep but it opens a new one...  :
> > FILENAME does not work any more
> 
> myrouter# /tmp/busybox ash
> 
> BusyBox v0.61.pre (2001.09.06-19:25+0000) Built-in shell (ash)
> Enter 'help' for a list of built-in commands.
> 
> myrouter# ls /tmp
> busybox       ssh-Fje27093  ssh-ukA27093
> myrouter# > /tmp/test
> myrouter# ls /tmp
> busybox       ssh-Fje27093  ssh-ukA27093
> myrouter#
> 
> may you help us again, vladimir ;-) ??

Vladimir is my Real Name. Please write this with capital letter.


--w
vodz
-------------- next part --------------
--- /home/dzo/ash.c	Fri Sep  7 15:13:57 2001
+++ ash.c	Fri Sep  7 14:51:58 2001
@@ -9664,7 +9664,7 @@
 static union node *andor (void);
 static union node *pipeline (void);
 static union node *command (void);
-static union node *simplecmd (void);
+static union node *simplecmd(union node **rpp, union node *redir);
 static void parsefname (void);
 static void parseheredoc (void);
 static char peektoken (void);
@@ -10036,7 +10036,7 @@
 			synexpect(-1);
 	case TWORD:
 		tokpushback++;
-		n1 = simplecmd();
+		n1 = simplecmd(rpp, redir);
 		return n1;
 	default:
 		synexpect(-1);
@@ -10066,18 +10066,25 @@
 
 
 static union node *
-simplecmd() {
+simplecmd(union node **rpp, union node *redir) {
 	union node *args, **app;
 	union node *n = NULL;
 	union node *vars, **vpp;
-	union node **rpp, *redir;
+	union node **orig_rpp;
 
 	args = NULL;
 	app = &args;
 	vars = NULL;
 	vpp = &vars;
-	redir = NULL;
-	rpp = &redir;
+
+	/* If we don't have any redirections already, then we must reset
+	   rpp to be the address of the local redir variable.  */
+	if (redir == 0)
+		rpp = &redir;
+	/* We save the incoming value, because we need this for shell
+	   functions.  There can not be a redirect or an argument between
+	   the function name and the open parenthesis.  */
+	orig_rpp = rpp;
 
 	checkalias = 2;
 	for (;;) {
@@ -10104,7 +10111,7 @@
 		case TLP:
 			if (
 				args && app == &args->narg.next &&
-				!vars && !redir
+				!vars && rpp == orig_rpp
 			) {
 				/* We have a function */
 				if (readtoken() != TRP)


More information about the busybox mailing list