From 9cae530b6706fb82444cec125c47302fcc19bdcc Mon Sep 17 00:00:00 2001 From: tron Date: Mon, 26 May 2008 14:55:17 +0000 Subject: [PATCH] Revert revisions 1.91 and 1.92. The POSIX spec about the correct behaviour is contradictory at best. And these changes seem to cause more problems that they are worth. --- bin/sh/eval.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/bin/sh/eval.c b/bin/sh/eval.c index f0a4ff5e2a50..ec7d212faf39 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -1,4 +1,4 @@ -/* $NetBSD: eval.c,v 1.92 2008/05/24 22:24:32 tron Exp $ */ +/* $NetBSD: eval.c,v 1.93 2008/05/26 14:55:17 tron Exp $ */ /*- * Copyright (c) 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; #else -__RCSID("$NetBSD: eval.c,v 1.92 2008/05/24 22:24:32 tron Exp $"); +__RCSID("$NetBSD: eval.c,v 1.93 2008/05/26 14:55:17 tron Exp $"); #endif #endif /* not lint */ @@ -238,14 +238,12 @@ evaltree(union node *n, int flags) evaltree(n->nbinary.ch2, flags); break; case NAND: - do_etest = true; evaltree(n->nbinary.ch1, EV_TESTED); if (evalskip || exitstatus != 0) goto out; evaltree(n->nbinary.ch2, flags); break; case NOR: - do_etest = true; evaltree(n->nbinary.ch1, EV_TESTED); if (evalskip || exitstatus == 0) goto out; @@ -258,8 +256,8 @@ evaltree(union node *n, int flags) popredir(); break; case NSUBSHELL: - do_etest = true; evalsubshell(n, flags); + do_etest = !(flags & EV_TESTED); break; case NBACKGND: evalsubshell(n, flags); @@ -291,17 +289,16 @@ evaltree(union node *n, int flags) exitstatus = 0; break; case NNOT: - do_etest = true; evaltree(n->nnot.com, EV_TESTED); exitstatus = !exitstatus; break; case NPIPE: - do_etest = true; evalpipe(n); + do_etest = !(flags & EV_TESTED); break; case NCMD: - do_etest = true; evalcommand(n, flags, (struct backcmd *)NULL); + do_etest = !(flags & EV_TESTED); break; default: out1fmt("Node type = %d\n", n->type); @@ -311,10 +308,8 @@ evaltree(union node *n, int flags) out: if (pendingsigs) dotrap(); - if ((flags & EV_EXIT) != 0 || - (eflag && exitstatus != 0 && do_etest && !(flags & EV_TESTED))) { + if ((flags & EV_EXIT) != 0 || (eflag && exitstatus != 0 && do_etest)) exitshell(exitstatus); - } }