Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: "breaks" variable incorrectly reset in "doshfunc()"
- X-seq: zsh-workers 2824
- From: Zoltan Hidvegi <hzoli@xxxxxxxxxx>
- To: ouwehand@xxxxxxxxxxx
- Subject: Re: "breaks" variable incorrectly reset in "doshfunc()"
- Date: Mon, 27 Jan 1997 22:57:59 +0100 (MET)
- Cc: zsh-workers@xxxxxxxxxxxxxxx
- In-reply-to: <9701271714.AA14892@xxxxxxxxxxxxx> from Martin Ouwehand at "Jan 27, 97 06:14:04 pm"
- Organization: Dept. of Comp. Sci., Eotvos University, Budapest, Hungary
- Phone: (36 1)2669833 ext: 2667, home phone: (36 1) 2752368
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;
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author