From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from math.gatech.edu (euclid.skiles.gatech.edu [130.207.146.50]) by werple.net.au (8.7/8.7.1) with SMTP id FAA20556 for ; Thu, 9 Nov 1995 05:58:24 +1100 (EST) Received: by math.gatech.edu (5.x/SMI-SVR4) id AA22407; Wed, 8 Nov 1995 13:10:35 -0500 Resent-Date: Wed, 8 Nov 1995 10:08:33 -0800 Old-Return-Path: Date: Wed, 8 Nov 1995 10:08:33 -0800 From: Mark Hanson Message-Id: <199511081808.KAA05665@acucobol.acucobol.com> To: zsh-workers@math.gatech.edu Subject: TRAPZERR and interrupting loops Resent-Message-Id: <"ocQQH.0.zT5.QAFem"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/568 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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