From: Zoltan Hidvegi <hzoli@cs.elte.hu>
To: ouwehand@sic.epfl.ch
Cc: zsh-workers@math.gatech.edu
Subject: Re: "breaks" variable incorrectly reset in "doshfunc()"
Date: Mon, 27 Jan 1997 22:57:59 +0100 (MET) [thread overview]
Message-ID: <199701272158.WAA13542@bolyai.cs.elte.hu> (raw)
In-Reply-To: <9701271714.AA14892@sehp1.epfl.ch> from Martin Ouwehand at "Jan 27, 97 06:14:04 pm"
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;
}
prev parent reply other threads:[~1997-01-27 22:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-01-27 17:14 Martin Ouwehand
1997-01-27 21:57 ` Zoltan Hidvegi [this message]
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=199701272158.WAA13542@bolyai.cs.elte.hu \
--to=hzoli@cs.elte.hu \
--cc=ouwehand@sic.epfl.ch \
--cc=zsh-workers@math.gatech.edu \
/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).