Source-Changes-HG archive

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

[src/trunk]: src/bin/sh PR bin/53201



details:   https://anonhg.NetBSD.org/src/rev/baa4166fce74
branches:  trunk
changeset: 318411:baa4166fce74
user:      kre <kre%NetBSD.org@localhost>
date:      Sat Apr 21 21:32:14 2018 +0000
description:
PR bin/53201

Don't synerr on
        ${var-anything
        more}

The newline in the middle of the var expansion is permitted.

Bug reported by Martijn Dekker from his modernish tests.

XXX pullup-8

diffstat:

 bin/sh/parser.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 08da558fda42 -r baa4166fce74 bin/sh/parser.c
--- a/bin/sh/parser.c   Sat Apr 21 21:28:35 2018 +0000
+++ b/bin/sh/parser.c   Sat Apr 21 21:32:14 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parser.c,v 1.145 2017/11/10 17:31:12 kre Exp $ */
+/*     $NetBSD: parser.c,v 1.146 2018/04/21 21:32:14 kre Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c   8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.145 2017/11/10 17:31:12 kre Exp $");
+__RCSID("$NetBSD: parser.c,v 1.146 2018/04/21 21:32:14 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -1773,7 +1773,7 @@
                CHECKSTRSPACE(4, out);  /* permit 4 calls to USTPUTC */
                switch (syntax[c]) {
                case CNL:       /* '\n' */
-                       if (syntax == BASESYNTAX)
+                       if (syntax == BASESYNTAX && varnest == 0)
                                break;  /* exit loop */
                        USTPUTC(c, out);
                        plinno++;



Home | Main Index | Thread Index | Old Index