summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcracauer <cracauer@FreeBSD.org>2004-01-28 18:22:19 +0000
committercracauer <cracauer@FreeBSD.org>2004-01-28 18:22:19 +0000
commit640c6c8f64bc06d838e7419f1401501149088634 (patch)
treef8580a11118d4576322d73b996f4986c71681a81
parentad8cf9f476bd7727d59648aa3174580fb93a3dd4 (diff)
downloadFreeBSD-src-640c6c8f64bc06d838e7419f1401501149088634.zip
FreeBSD-src-640c6c8f64bc06d838e7419f1401501149088634.tar.gz
The PR diff I committed recently had one bug noticed by
Joe Marcus Clarke <marcus@FreeBSD.ORG>, subshells could lose a non-zero exit status. This commit is Joe's proposed patch. Thanks! I verified that the problem Joe found is fixed and I ran a full world with this patch. I don't plan to ever commit language patches to /bin/sh again. It is a minefield too big to navigate without a full-time committment, which I am not willing to do on our /bin/sh. Under normal circumstances I would recommend using NetBSD's sh which has a lot of language fixes (like the ones what these patches were about) but unfortunately they had implemented broken signal behaviour for shellscript containing interactive programs. Similar issues apply to pdksh which is OpenBSD's sh. From my perspective bash2 is the only really working bourne sh out there and that one is GPLed. Oh well.
-rw-r--r--bin/sh/eval.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c
index 38282d4..b8c0589 100644
--- a/bin/sh/eval.c
+++ b/bin/sh/eval.c
@@ -273,7 +273,8 @@ out:
if (pendingsigs)
dotrap();
if ((flags & EV_EXIT) || (eflag && exitstatus
- && !(flags & EV_TESTED) && (n->type == NCMD)))
+ && !(flags & EV_TESTED) && (n->type == NCMD ||
+ n->type == NSUBSHELL)))
exitshell(exitstatus);
}
OpenPOWER on IntegriCloud