From owner-svn-src-all@FreeBSD.ORG Wed Apr 20 22:24:54 2011 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 B837F106566C; Wed, 20 Apr 2011 22:24:54 +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 A74448FC0A; Wed, 20 Apr 2011 22:24:54 +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 p3KMOs39068931; Wed, 20 Apr 2011 22:24:54 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3KMOsKp068928; Wed, 20 Apr 2011 22:24:54 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201104202224.p3KMOsKp068928@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 20 Apr 2011 22:24:54 +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: r220903 - in head: bin/sh tools/regression/bin/sh/expansion 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: Wed, 20 Apr 2011 22:24:54 -0000 Author: jilles Date: Wed Apr 20 22:24:54 2011 New Revision: 220903 URL: http://svn.freebsd.org/changeset/base/220903 Log: sh: Do not word split "${#parameter}". This is only a problem if IFS contains digits, which is unusual but valid. Because of an incorrect fix for PR bin/12137, "${#parameter}" was treated as ${#parameter}. The underlying problem was that "${#parameter}" erroneously added CTLESC bytes before determining the length. This was properly fixed for PR bin/56147 but the incorrect fix was not backed out. Reported by: Seeker on forums.freebsd.org MFC after: 2 weeks Added: head/tools/regression/bin/sh/expansion/length6.0 (contents, props changed) Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Wed Apr 20 22:10:44 2011 (r220902) +++ head/bin/sh/parser.c Wed Apr 20 22:24:54 2011 (r220903) @@ -1572,8 +1572,8 @@ varname: pungetc(); } STPUTC('=', out); - if (subtype != VSLENGTH && (state[level].syntax == DQSYNTAX || - state[level].syntax == ARISYNTAX)) + if (state[level].syntax == DQSYNTAX || + state[level].syntax == ARISYNTAX) flags |= VSQUOTE; *(stackblock() + typeloc) = subtype | flags; if (subtype != VSNORMAL) { Added: head/tools/regression/bin/sh/expansion/length6.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/length6.0 Wed Apr 20 22:24:54 2011 (r220903) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +x='!@#$%^&*()[]' +[ ${#x} = 12 ] || echo bad 1 +[ "${#x}" = 12 ] || echo bad 2 +IFS=2 +[ ${#x} = 1 ] || echo bad 3 +[ "${#x}" = 12 ] || echo bad 4