zsh-workers
 help / color / mirror / code / Atom feed
* TRAPZERR and interrupting loops
@ 1995-11-08 18:08 Mark Hanson
  0 siblings, 0 replies; only message in thread
From: Mark Hanson @ 1995-11-08 18:08 UTC (permalink / raw)
  To: zsh-workers

I've had trouble for some time now with interrupting loops when
TRAPZERR is defined.  I've finally taken the time to figure out what's
going on in the code to cause this.

It appears that when doshfunc() is called inside dotrap(), the variable
"breaks" is being reset and causing the loop to not end as it does
without TRAPZERR being set.  I put code in to save the old value and
restore it after the call to doshfunc(), and it seems to work okay.  I
have no idea what else it breaks, though.  It would be good if someone
more familiar with this code could take a look.

To reproduce:

prompt% ./zsh -f
prompt% for x in 1 2 3 4 5; do
> echo $x
> sleep 1
> done

(hit ^C here and the loop will end)

prompt% TRAPZERR() { echo darn }

(run the same loop again, hit return, and the loop will not end)

Also, I noticed that lastval is defined as a long in globals.h, but it
is assigned to an int in signals.c/dotrap() (savval) and exec.c/doshfunc()
(oldlastval).  I'm not sure if lastval should be an int or the others
should be longs.

All this is with 2.6-beta11 on SunOS 4.1.3.

Thanks,
Mark


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1995-11-08 18:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-11-08 18:08 TRAPZERR and interrupting loops Mark Hanson

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).