From owner-svn-src-all@FreeBSD.ORG Sat Apr 3 20:35:39 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84D5E106564A; Sat, 3 Apr 2010 20:35:39 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73C418FC12; Sat, 3 Apr 2010 20:35:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o33KZdC2093114; Sat, 3 Apr 2010 20:35:39 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o33KZdoS093112; Sat, 3 Apr 2010 20:35:39 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201004032035.o33KZdoS093112@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 3 Apr 2010 20:35:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206144 - head/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2010 20:35:39 -0000 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);