From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22915 invoked from network); 27 Jan 1997 22:00:32 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 27 Jan 1997 22:00:32 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id QAA05218; Mon, 27 Jan 1997 16:56:23 -0500 (EST) Resent-Date: Mon, 27 Jan 1997 16:56:23 -0500 (EST) From: Zoltan Hidvegi Message-Id: <199701272158.WAA13542@bolyai.cs.elte.hu> Subject: Re: "breaks" variable incorrectly reset in "doshfunc()" In-Reply-To: <9701271714.AA14892@sehp1.epfl.ch> from Martin Ouwehand at "Jan 27, 97 06:14:04 pm" To: ouwehand@sic.epfl.ch Date: Mon, 27 Jan 1997 22:57:59 +0100 (MET) Cc: zsh-workers@math.gatech.edu Organization: Dept. of Comp. Sci., Eotvos University, Budapest, Hungary Phone: (36 1)2669833 ext: 2667, home phone: (36 1) 2752368 X-Mailer: ELM [version 2.4ME+ PL27 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"PDRNY2.0.QH1.6IIxo"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2824 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Martin Ouwehand wrote: > My analysis is that "doshfunc()" is called because TRAPDEBUG is set and > this function resets the "breaks" variable to 0 a bit too early. See below > for the patch I propose (I don't know if it will break something else.) I think this breaks = 0 assignment is unnecessary. But in signals.c this has to be handled somehow. Zoltan *** Src/exec.c 1997/01/26 02:55:02 3.1.1.10 --- Src/exec.c 1997/01/27 20:56:46 *************** *** 2585,2591 **** zfree(locallist, sizeof(struct linklist)); locallist = olist; /* restore the old list of local variables */ ! breaks = retflag = 0; freearray(pparams); if (oargv0) { zsfree(argzero); --- 2585,2591 ---- zfree(locallist, sizeof(struct linklist)); locallist = olist; /* restore the old list of local variables */ ! retflag = 0; freearray(pparams); if (oargv0) { zsfree(argzero); *** Src/signals.c 1997/01/26 02:54:35 3.1.1.2 --- Src/signals.c 1997/01/27 20:49:30 *************** *** 664,669 **** --- 664,670 ---- LinkList args; char *name, num[4]; int trapret = 0; + int obreaks = breaks; /* if signal is being ignored or the trap function * * is NULL, then return * *************** *** 680,685 **** --- 681,687 ---- lexsave(); execsave(); + breaks = 0; if (sigtrapped[sig] & ZSIG_FUNC) { PERMALLOC { args = newlinklist(); *************** *** 706,714 **** if (trapret > 0) { breaks = loops; errflag = 1; } if (sigtrapped[sig] != ZSIG_IGNORED) sigtrapped[sig] &= ~ZSIG_IGNORED; } - --- 708,719 ---- if (trapret > 0) { breaks = loops; errflag = 1; + } else { + breaks += obreaks; + if (breaks > loops) + breaks = loops; } if (sigtrapped[sig] != ZSIG_IGNORED) sigtrapped[sig] &= ~ZSIG_IGNORED; }