Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: doshfunc()
- X-seq: zsh-workers 15321
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: PATCH: doshfunc()
- Date: Mon, 9 Jul 2001 11:08:22 +0000
- In-reply-to: <200107090822.KAA13841@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <200107090822.KAA13841@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
On Jul 9, 10:22am, Sven Wischnowsky wrote:
} Subject: Re: PATCH: Re: Is PRINT_EXIT_VALUE supposed to work?
}
} Bart Schaefer wrote:
}
} > Meanwhile, I think I've spotted a bug in doshfunc().
}
} Whoa. I think this was indeed wrong.
OK, here's a very slightly different patch, which I will commit later unless
somebody says I should not. The first hunk just copies a bit of code from
line 3251 (big file) to another spot in the same function where it is also
needed.
Meanwhile, Sven: When exactly does the EF_RUN flag get set? That is, I
can see where it gets set in the code, but what set of circumstances does
that actually represent? I tried several things with kshautoload and
zcompile but I couldn't get the `goto doneshfunc' below to be reached. It
always complained instead at the zwarn in the first hunk.
Index: Src/exec.c
===================================================================
diff -c -r1.7 Src/exec.c
--- Src/exec.c 2001/06/28 08:40:25 1.7
+++ Src/exec.c 2001/07/09 07:07:10
@@ -3273,7 +3273,10 @@
execode(prog, 1, 0);
shf = (Shfunc) shfunctab->getnode(shfunctab, n);
if (!shf || (shf->flags & PM_UNDEFINED)) {
+ /* We're not actually in the function; decrement locallevel */
+ locallevel--;
zwarn("%s: function not defined by file", n, 0);
+ locallevel++;
popheap();
return NULL;
}
@@ -3359,9 +3362,7 @@
if(++funcdepth > MAX_FUNCTION_DEPTH)
{
zerr("maximum nested function level reached", NULL, 0);
- scriptname = oldscriptname;
- popheap();
- return;
+ goto undoshfunc;
}
#endif
fstack.name = dupstring(name);
@@ -3382,15 +3383,15 @@
errflag = 1;
else
lastval = 1;
- popheap();
- scriptname = oldscriptname;
- return;
+ goto doneshfunc;
}
prog = shf->funcdef;
}
runshfunc(prog, wrappers, fstack.name);
+ doneshfunc:
funcstack = fstack.prev;
#ifdef MAX_FUNCTION_DEPTH
+ undoshfunc:
--funcdepth;
#endif
if (retflag) {
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author