Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh When (about to) send the -x output for the end of a c...



details:   https://anonhg.NetBSD.org/src/rev/7177385b833d
branches:  trunk
changeset: 993915:7177385b833d
user:      kre <kre%NetBSD.org@localhost>
date:      Tue Oct 09 02:43:41 2018 +0000

description:
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)]

diffstat:

 bin/sh/eval.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 655e3521e70e -r 7177385b833d bin/sh/eval.c
--- a/bin/sh/eval.c     Tue Oct 09 01:28:35 2018 +0000
+++ b/bin/sh/eval.c     Tue Oct 09 02:43:41 2018 +0000
@@ -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 @@
                handler = savehandler;
                e = exception;
                popredir();
-               if (xflag && n->nredir.redirect) {
+               if (PS4 != NULL) {
                        outxstr(PS4);
                        /* { */ outxstr("} failed\n");
                        flushout(outx);
@@ -650,7 +650,7 @@
        popredir();
        INTON;
 
-       if (xflag && n->nredir.redirect) {
+       if (PS4 != NULL) {
                outxstr(PS4);
                /* { */ outxstr("} done\n");
                flushout(outx);



Home | Main Index | Thread Index | Old Index