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)
This commit is contained in:
parent
c3d72c80d3
commit
fc0818fef3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=221461
@ -1569,6 +1569,8 @@ parsesub: {
|
||||
}
|
||||
}
|
||||
} else if (subtype != VSERROR) {
|
||||
if (subtype == VSLENGTH && c != '}')
|
||||
subtype = VSERROR;
|
||||
pungetc();
|
||||
}
|
||||
STPUTC('=', out);
|
||||
|
2
tools/regression/bin/sh/errors/bad-parm-exp6.2
Normal file
2
tools/regression/bin/sh/errors/bad-parm-exp6.2
Normal file
@ -0,0 +1,2 @@
|
||||
# $FreeBSD$
|
||||
${#foo^}
|
1
tools/regression/bin/sh/errors/bad-parm-exp6.2.stderr
Normal file
1
tools/regression/bin/sh/errors/bad-parm-exp6.2.stderr
Normal file
@ -0,0 +1 @@
|
||||
./errors/bad-parm-exp6.2: ${foo...}: Bad substitution
|
Loading…
Reference in New Issue
Block a user