Weird behavior of 'ash' with "remove prefix/suffix pattern" in parameter expansion
Denys Vlasenko
vda.linux at googlemail.com
Wed Nov 23 23:38:28 UTC 2016
On Tue, Nov 22, 2016 at 6:17 PM, walter harms <wharms at bfs.de> wrote:
> busybox 1.25.0
> $ TEST="[ \t\r]"
> $ echo ${TEST%]}
> [ \t\r
> $ echo ${TEST#[}
> [ \t\r]
>
> GNU bash, version 3.2.39
> $ TEST="[ \t\r]"
> echo ${TEST%]}
> [ \t\r
> echo "${TEST#[}"
> \t\r]
>
> It seems that ${#} does not eat [:
> TEST="[[[[" ; echo "${TEST#[}"
> [[[[
> TEST="[[[[" ; echo "${TEST#[}"
> [[[
Reproduced. Looks like a bug in uclibc:
pmatch("[","[") returns 0 "no match",
but in glibc, it returns 1.
More information about the busybox
mailing list