From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27284 invoked from network); 9 Jul 2001 11:11:55 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 9 Jul 2001 11:11:55 -0000 Received: (qmail 24145 invoked by alias); 9 Jul 2001 11:11:46 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15321 Received: (qmail 24117 invoked from network); 9 Jul 2001 11:11:45 -0000 From: "Bart Schaefer" Message-Id: <1010709110822.ZM19848@candle.brasslantern.com> Date: Mon, 9 Jul 2001 11:08:22 +0000 In-Reply-To: <200107090822.KAA13841@beta.informatik.hu-berlin.de> Comments: In reply to Sven Wischnowsky "Re: PATCH: Re: Is PRINT_EXIT_VALUE supposed to work?" (Jul 9, 10:22am) References: <200107090822.KAA13841@beta.informatik.hu-berlin.de> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk Subject: PATCH: doshfunc() MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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