Date: Thu, 5 Aug 1999 20:30:02 -0700 (PDT) From: "Danny J. Zerkel" <dzerkel@columbus.rr.com> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/12806: `sh -e' doesn't parse multi-command lines correctly Message-ID: <199908060330.UAA55866@freefall.freebsd.org>
index | next in thread | raw e-mail
The following reply was made to PR bin/12806; it has been noted by GNATS.
From: "Danny J. Zerkel" <dzerkel@columbus.rr.com>
To: freebsd-gnats-submit@freebsd.org, arensb@clue.umiacs.umd.edu
Cc:
Subject: Re: bin/12806: `sh -e' doesn't parse multi-command lines correctly
Date: Thu, 05 Aug 1999 23:20:12 -0400
I confirmed that ksh works as expected and the sh on Solaris works as
expected,
so I poked around and I have included a patch below. What it looks like
is that
for a semicolon node, evaltree() calls evaltree() for both sides of the
node and
then retests the eflag, even though it has already been tested on each
side of
the node. There is no reason, that I can see, for the semicolon node to
check
the eflag, so I just made it do the other tests and return.
--- /usr/src/bin/sh/eval.c.orig Thu Aug 5 23:08:44 1999
+++ /usr/src/bin/sh/eval.c Thu Aug 5 23:13:31 1999
@@ -200,10 +200,14 @@
switch (n->type) {
case NSEMI:
evaltree(n->nbinary.ch1, 0);
- if (evalskip)
- goto out;
- evaltree(n->nbinary.ch2, flags);
- break;
+ if (!evalskip) {
+ evaltree(n->nbinary.ch2, flags);
+ }
+ if (pendingsigs)
+ dotrap();
+ if (flags & EV_EXIT)
+ exitshell(exitstatus);
+ return;
case NAND:
evaltree(n->nbinary.ch1, EV_TESTED);
if (evalskip || exitstatus != 0) {
-- Danny J. Zerkel
dzerkel@columbus.rr.com
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908060330.UAA55866>
