Date: Wed, 4 May 2011 21:49:34 +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: r221461 - in head: bin/sh tools/regression/bin/sh/errors Message-ID: <201105042149.p44LnYr1068623@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Wed May 4 21:49:34 2011 New Revision: 221461 URL: http://svn.freebsd.org/changeset/base/221461 Log: sh: Detect an error for ${#var<GARBAGE>}. In particular, this makes things like ${#foo[0]} and ${#foo[@]} errors rather than silent equivalents of ${#foo}. PR: bin/151720 Submitted by: Mark Johnston Exp-run done by: pav (with some other sh(1) changes) Added: head/tools/regression/bin/sh/errors/bad-parm-exp6.2 (contents, props changed) head/tools/regression/bin/sh/errors/bad-parm-exp6.2.stderr (contents, props changed) Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Wed May 4 21:27:05 2011 (r221460) +++ head/bin/sh/parser.c Wed May 4 21:49:34 2011 (r221461) @@ -1569,6 +1569,8 @@ varname: } } } else if (subtype != VSERROR) { + if (subtype == VSLENGTH && c != '}') + subtype = VSERROR; pungetc(); } STPUTC('=', out); Added: head/tools/regression/bin/sh/errors/bad-parm-exp6.2 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/errors/bad-parm-exp6.2 Wed May 4 21:49:34 2011 (r221461) @@ -0,0 +1,2 @@ +# $FreeBSD$ +${#foo^} Added: head/tools/regression/bin/sh/errors/bad-parm-exp6.2.stderr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/errors/bad-parm-exp6.2.stderr Wed May 4 21:49:34 2011 (r221461) @@ -0,0 +1 @@ +./errors/bad-parm-exp6.2: ${foo...}: Bad substitution
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105042149.p44LnYr1068623>