diff options
author | jilles <jilles@FreeBSD.org> | 2011-05-04 21:49:34 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2011-05-04 21:49:34 +0000 |
commit | fa0f3c42ef6452770ad1eaf8d50f9b2e7af7fb88 (patch) | |
tree | a70b358bc2039c03fc15cbaeaba4323d4cbd34d9 /bin | |
parent | 0cc27c3d6b2a3daf9dd8312fbbe87f86d0d55ce7 (diff) | |
download | FreeBSD-src-fa0f3c42ef6452770ad1eaf8d50f9b2e7af7fb88.zip FreeBSD-src-fa0f3c42ef6452770ad1eaf8d50f9b2e7af7fb88.tar.gz |
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)
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sh/parser.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c index c4191b4..43822f9 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -1569,6 +1569,8 @@ varname: } } } else if (subtype != VSERROR) { + if (subtype == VSLENGTH && c != '}') + subtype = VSERROR; pungetc(); } STPUTC('=', out); |