Module Name:    src
Committed By:   kre
Date:           Sat Apr 21 21:32:14 UTC 2018

Modified Files:
        src/bin/sh: parser.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/bin/sh/parser.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/parser.c
diff -u src/bin/sh/parser.c:1.145 src/bin/sh/parser.c:1.146
--- src/bin/sh/parser.c:1.145	Fri Nov 10 17:31:12 2017
+++ src/bin/sh/parser.c	Sat Apr 21 21:32:14 2018
@@ -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 @@ readtoken1(int firstc, char const *syn, 
 		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++;

Reply via email to