Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Apr 2010 20:35:39 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r206144 - head/bin/sh
Message-ID:  <201004032035.o33KZdoS093112@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004032035.o33KZdoS093112>