klibc-bot for Herbert Xu
2020-Mar-28 21:49 UTC
[klibc] [klibc:update-dash] dash: parser: Only accept single-digit parameter expansion outside of braces
Commit-ID: 82ab2c44da800190b0a92336162ca67ba4673600 Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=82ab2c44da800190b0a92336162ca67ba4673600 Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Mon, 27 May 2019 13:39:37 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:55 +0000 [klibc] dash: parser: Only accept single-digit parameter expansion outside of braces [ dash commit 7710a926b321879b84bf349b865b1dd4c52083f8 ] On Thu, Apr 25, 2019 at 01:39:52AM +0000, Michael Orlitzky wrote:> The POSIX spec says, > > The parameter name or symbol can be enclosed in braces, which are > optional except for positional parameters with more than one digit or > when parameter is a name and is followed by a character that could be > interpreted as part of the name. > > However, dash seems to diverge from that behavior when we get to $10: > > $ cat test.sh > echo $10 > > $ dash ./test.sh one two three four five six seven eight nine ten > ten > > $ bash ./test.sh one two three four five six seven eight nine ten > one0This patch should fix the problem. Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index 4bda42e8..b318b085 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -1268,7 +1268,7 @@ varname: do { STPUTC(c, out); c = pgetc_eatbnl(); - } while (is_digit(c)); + } while (!subtype && is_digit(c)); } else if (c != '}') { int cc = c;
Possibly Parallel Threads
- [klibc:update-dash] dash: [PARSER] Handle backslash newlines properly after dollar sign
- [klibc:update-dash] [PARSER] Handle backslash newlines properly after dollar sign
- [klibc:update-dash] dash: [PARSER] Catch variable length expansions on non-existant specials
- [klibc:update-dash] [PARSER] Catch variable length expansions on non-existant specials
- [klibc:update-dash] dash: parser: Fix parsing of ${}