[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: Weird behavior of 'ash' with "remove prefix/suffix pattern" in parameter expansion
From:       walter harms <wharms () bfs ! de>
Date:       2016-11-24 9:58:42
Message-ID: 5836B9D2.1050407 () bfs ! de
[Download RAW message or body]



Am 24.11.2016 10:29, schrieb Denys Vlasenko:
> On Thu, Nov 24, 2016 at 12:38 AM, Denys Vlasenko
> <vda.linux@googlemail.com> wrote:
>> On Tue, Nov 22, 2016 at 6:17 PM, walter harms <wharms@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.
> 
> Just for the record. "pmatch" I talked about is
> a define in ash.c, on libc level, it's fnmatch:
> 
> #define pmatch(a, b) !fnmatch((a), (b), 0)
> 

i have tested:
#include <stdio.h>

#define pmatch(a, b) !fnmatch((a), (b), 0)

int main()
{
        printf("test:%d\n",pmatch("[","["));
        return 0;
}
./fnmatch
test:0

this seems the problem.

re,
 wh

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic