Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 06 Oct 1996 09:08:22 -0500
From:      VaX#n8 <vax@linkdead.paranoia.com>
To:        freebsd-bugs@freebsd.org
Subject:   /bin/sh fix for ya
Message-ID:  <199610061408.JAA08243@linkdead.paranoia.com>

next in thread | raw e-mail | index | archive | help
how-to-repeat:
/bin/sh -ec 'false && true; echo hi'

this conflicts with:
       -e    errexit
              If not interactive, exit immediately if any
              untested command fails.  The exit status of a
              command is considered to be explicitly tested if
              the command is used to control an if, elif, while,
              or until; or if the command is the left hand
              operand of an ``&&'' or ``||'' operator.

PS: Thanks for letting me (well, anyone) use the cool CVS tree
website.  It's fairly convenient in some cases (other times I wish
I had full shell/CVS access but oh well).
I "fixed" a few things in NetBSD with your changes.
...OS hacking without prejudice.... the VaX#n8er...

fix:
--- ../sh.netbsd/eval.c	Tue Jun 11 06:14:10 1996
+++ eval.c	Sun Oct  6 08:43:15 1996
@@ -207,8 +207,11 @@
 		break;
 	case NAND:
 		evaltree(n->nbinary.ch1, EV_TESTED);
-		if (evalskip || exitstatus != 0)
+		if (evalskip || exitstatus != 0) {
+			/* don't bomb out on "set -e; false && true" */
+			flags |= EV_TESTED;
 			goto out;
+		}
 		evaltree(n->nbinary.ch2, flags);
 		break;
 	case NOR:




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610061408.JAA08243>