From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gatech.edu (gatech.edu [130.207.244.244]) by werple.mira.net.au (8.6.12/8.6.9) with SMTP id DAA20348 for ; Tue, 30 May 1995 03:53:29 +1000 Received: from math (math.skiles.gatech.edu) by gatech.edu with SMTP id AA12807 (5.65c/Gatech-10.0-IDA for ); Mon, 29 May 1995 13:53:22 -0400 Received: by math (5.x/SMI-SVR4) id AA03192; Mon, 29 May 1995 13:51:28 -0400 Resent-Date: Mon, 29 May 1995 19:50:34 +0100 (MET DST) Old-Return-Path: From: hzoli@cs.elte.hu (Zoltan Hidvegi) Message-Id: <9505291750.AA01021@turan.elte.hu> Subject: Some bugreports and a fix To: zsh-workers@math.gatech.edu (zsh-workers) Date: Mon, 29 May 1995 19:50:34 +0100 (MET DST) X-Mailer: ELM [version 2.4 PL21] Content-Type: text Resent-Message-Id: <"iFUic.0.on.VcWol"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/51 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Zsh exits from a script if it finds a syntax error while executing an eval command. Eg. in eval let '8#8' echo Right Right is not printed. This is because eval uses the lexer which changes the tok global variable. But the main loop examines tok to decide if it has to exit if errflag is nonzero. To fix this the patch below saves tok before calling execlist. With my zsh version this bug occured more often as the lexer is used more often. I discovered this when zsh exited from my shutdown script leaving the filesystems mounted (I had to do a hard reset). There is a similar problem which is not fixed by this patch: % let '8#8' ; echo right again does not print `right'. That's because execcmd() does not executes a command if errflag is true. This particular problem can be fixed by uncommenting the errflag = 0; assignment in exec.c in execlist but it probably has unwanted side effects. I really do not know this part of the code so someone more expert should look at it. An other bug is that TRAPZERR is not executed in the above cases. But TRAPZERR is exectued in other cases when it shouldn't: both % false || foo=bug and % if false; then true; else foo=bug; fi calls TRAPZERR. I think the problem is that a single assignment does not reset lastval. Also a bug (or sh incompatibility) is that % false && true exits the shell if ERR_EXIT is set. It's a problem since foo && bar is a common idiom in shell scripts. The general idea is that ERR_EXIT and TRAPZERR should be ignored for a command whose return value is used to decide wether to execute something or not. Zoltan *** 1.6 1995/05/05 22:01:58 --- Src/init.c 1995/05/28 21:06:06 *************** *** 110,118 **** --- 110,121 ---- continue; } if (hend()) { + int toksav = tok; + if (stopmsg) /* unset 'you have stopped jobs' flag */ stopmsg--; execlist(list, 0); + tok = toksav; if (toplevel) noexitct = 0; }