mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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
3 changed files with 5 additions and 0 deletions
|
|
@ -1569,6 +1569,8 @@ varname:
|
|||
}
|
||||
}
|
||||
} 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 a new issue