Source-Changes-HG archive

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

[src/trunk]: src/bin/sh This change affects shells compiled in DEBUG mode onl...



details:   https://anonhg.NetBSD.org/src/rev/774cd80a39e1
branches:  trunk
changeset: 353405:774cd80a39e1
user:      kre <kre%NetBSD.org@localhost>
date:      Wed May 03 21:34:51 2017 +0000

description:
This change affects shells compiled in DEBUG mode only, for normal
shells (anything made by build.sh) there is no change at all.

In DEBUG shells, when tree dumping, remember to include NNOT (same
omission as was just corrected in jobs.c :1.81) - of course, here there
are lots of other node types not handled as well.

ALso, avoid a core dump bug when doing a tree dump of a pieline
where the commands are not all simple commands (which can only
happen with a command string like " cmd | ! cmd | ... ".  The "!"
in the middle is utter nonsense, and should be forbidden, but
for now, at least avoid a core dump.

diffstat:

 bin/sh/show.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (45 lines):

diff -r 1ccc0ede0a24 -r 774cd80a39e1 bin/sh/show.c
--- a/bin/sh/show.c     Wed May 03 21:31:03 2017 +0000
+++ b/bin/sh/show.c     Wed May 03 21:34:51 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: show.c,v 1.36 2017/03/16 13:21:59 kre Exp $    */
+/*     $NetBSD: show.c,v 1.37 2017/05/03 21:34:51 kre Exp $    */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)show.c     8.3 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: show.c,v 1.36 2017/03/16 13:21:59 kre Exp $");
+__RCSID("$NetBSD: show.c,v 1.37 2017/05/03 21:34:51 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -127,9 +127,13 @@
                if (nl && len > 0)
                        len = 0, putc('\n', fp);
                break;
+       case NNOT:
+               fputs("! ", fp);
+               len += 2 + shtree(n->nnot.com, 0, 0, NULL, fp);
+               break;
        case NPIPE:
                for (lp = n->npipe.cmdlist ; lp ; lp = lp->next) {
-                       len += shcmd(lp->n, fp);
+                       len += shtree(lp->n, 0, 0, NULL, fp);
                        if (lp->next) {
                                len += 3, fputs(" | ", fp);
                                if (len >= 60)  {
@@ -273,8 +277,10 @@
                        putc('{', fp);
                        len += 2;
                        subtype = *++p;
-                       if (subtype == VSLENGTH)
+                       if ((subtype & VSTYPE) == VSLENGTH)
                                len++, putc('#', fp);
+                       if (subtype & VSLINENO)
+                               len += 7, fputs("LINENO=", fp);
 
                        while (*++p != '=')
                                len++, putc(*p, fp);



Home | Main Index | Thread Index | Old Index