Module Name: src Committed By: kre Date: Tue Oct 9 02:43:42 UTC 2018
Modified Files: src/bin/sh: eval.c Log Message: When (about to) send the -x output for the end of a compound command (which has redirects, and so is included in -x output) use the -x/+x setting that existed when the comoound started, so if the state of xtrace changes during the command we don't end up with just half of the -x output (either the intro, or the conclusion, depending on which way the change happened). [this also happens to avoid a core dump in the previous code, but that could have been done other ways, this way actually simplifies things (less code)] To generate a diff of this commit: cvs rdiff -u -r1.161 -r1.162 src/bin/sh/eval.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/sh/eval.c diff -u src/bin/sh/eval.c:1.161 src/bin/sh/eval.c:1.162 --- src/bin/sh/eval.c:1.161 Sat Aug 25 02:42:49 2018 +++ src/bin/sh/eval.c Tue Oct 9 02:43:41 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: eval.c,v 1.161 2018/08/25 02:42:49 kre Exp $ */ +/* $NetBSD: eval.c,v 1.162 2018/10/09 02:43:41 kre 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.161 2018/08/25 02:42:49 kre Exp $"); +__RCSID("$NetBSD: eval.c,v 1.162 2018/10/09 02:43:41 kre Exp $"); #endif #endif /* not lint */ @@ -625,7 +625,7 @@ evalredir(union node *n, int flags) handler = savehandler; e = exception; popredir(); - if (xflag && n->nredir.redirect) { + if (PS4 != NULL) { outxstr(PS4); /* { */ outxstr("} failed\n"); flushout(outx); @@ -650,7 +650,7 @@ evalredir(union node *n, int flags) popredir(); INTON; - if (xflag && n->nredir.redirect) { + if (PS4 != NULL) { outxstr(PS4); /* { */ outxstr("} done\n"); flushout(outx);