zsh-workers
 help / color / mirror / code / Atom feed
From: hzoli@cs.elte.hu (Zoltan Hidvegi)
To: zsh-workers@math.gatech.edu (zsh-workers)
Subject: Some bugreports and a fix
Date: Mon, 29 May 1995 19:50:34 +0100 (MET DST)	[thread overview]
Message-ID: <9505291750.AA01021@turan.elte.hu> (raw)

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;
  	}


             reply	other threads:[~1995-05-29 17:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-05-29 18:50 Zoltan Hidvegi [this message]
1995-05-31 17:45 ` P.Stephenson

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=9505291750.AA01021@turan.elte.hu \
    --to=hzoli@cs.elte.hu \
    --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).