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
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"