svn commit: r206144 - head/bin/sh
Jilles Tjoelker
jilles at FreeBSD.org
Sat Apr 3 20:35:39 UTC 2010
Author: jilles
Date: Sat Apr 3 20:35:39 2010
New Revision: 206144
URL: http://svn.freebsd.org/changeset/base/206144
Log:
sh: Treat unexpected newlines in substitutions as a syntax error.
The old approach was wrong because PS2 was not used and seems unlikely to
parse extensions (ksh93's ${ COMMAND} may well fail to parse).
Exp-run done by: erwin (with some other sh(1) changes)
Modified:
head/bin/sh/parser.c
Modified: head/bin/sh/parser.c
==============================================================================
--- head/bin/sh/parser.c Sat Apr 3 20:14:10 2010 (r206143)
+++ head/bin/sh/parser.c Sat Apr 3 20:35:39 2010 (r206144)
@@ -1401,6 +1401,8 @@ parsesub: {
subtype = VSERROR;
if (c == '}')
pungetc();
+ else if (c == '\n' || c == PEOF)
+ synerror("Unexpected end of line in substitution");
else
USTPUTC(c, out);
} else {
@@ -1417,6 +1419,8 @@ parsesub: {
default:
p = strchr(types, c);
if (p == NULL) {
+ if (c == '\n' || c == PEOF)
+ synerror("Unexpected end of line in substitution");
if (flags == VSNUL)
STPUTC(':', out);
STPUTC(c, out);
More information about the svn-src-all
mailing list