From owner-freebsd-bugs Thu Aug 5 20:31:55 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 791A514F12 for ; Thu, 5 Aug 1999 20:31:52 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id UAA55866; Thu, 5 Aug 1999 20:30:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Date: Thu, 5 Aug 1999 20:30:02 -0700 (PDT) Message-Id: <199908060330.UAA55866@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: "Danny J. Zerkel" Subject: Re: bin/12806: `sh -e' doesn't parse multi-command lines correctly Reply-To: "Danny J. Zerkel" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/12806; it has been noted by GNATS. From: "Danny J. Zerkel" 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