zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: PATCH: doshfunc()
Date: Mon, 9 Jul 2001 11:08:22 +0000	[thread overview]
Message-ID: <1010709110822.ZM19848@candle.brasslantern.com> (raw)
In-Reply-To: <200107090822.KAA13841@beta.informatik.hu-berlin.de>

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   


  reply	other threads:[~2001-07-09 11:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-15 13:22 Is PRINT_EXIT_VALUE supposed to work? Peter Stephenson
2001-06-24  4:06 ` PATCH: " Bart Schaefer
2001-07-03 17:13   ` Peter Stephenson
2001-07-03 17:46     ` Bart Schaefer
2001-07-08 15:19     ` Bart Schaefer
2001-07-09  8:22       ` Sven Wischnowsky
2001-07-09 11:08         ` Bart Schaefer [this message]
2001-07-09 11:28           ` PATCH: doshfunc Sven Wischnowsky
2001-07-09 16:11             ` Bart Schaefer
2001-07-10  9:42               ` Sven Wischnowsky
2001-07-10 16:06                 ` Bart Schaefer
2001-07-11  7:18                   ` Sven Wischnowsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1010709110822.ZM19848@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).