[BusyBox] BusyBox SED bugs reproducible at will.
Serge Caron
scaron at pcevolution.com
Mon Mar 18 15:35:04 UTC 2002
Oops!
This should read
echo "12345" | sed -e "s/[[:space:]]/,/"
12345 (as expected)
echo "12345" | sed -e "s/[[:space:]]*/,/"
,12345 (as expected)
^^^^^^^^^^^^^^
(BUG!!!)
^^^^^^^^^
echo "12345" | sed -e "s/[[:space:]]*/,/g"
(Infinite loop :()
>
>[This also explains the problem with 's/<any_char>*/,/g' but of
>course this must not run into an endless loop.]
>
In the above example, "12345" should yield ",1,2,3,4,5,": I am not aware of
any other problem :)
Regards,
Serge Caron
-----Original Message-----
From: Wolfgang Denk <wd at denx.de>
To: Serge Caron <scaron at pcevolution.com>
Cc: busybox at busybox.net <busybox at busybox.net>
Date: March 18, 2002 3:48 PM
Subject: Re: [BusyBox] BusyBox SED bugs reproducible at will.
>In message <001f01c1ceb4$d6dfa260$8400000a at piglet> you wrote:
>>
>> echo "12345" | sed -e "s/[[:space:]]*/,/"
>> ,12345 (BUG!!!)
>
>This is NOT a bug but regular behavious, since '*' matches zero or
>more occurrances of the pattern, thus it matches the zero space
>characters at the start of your string.
>
>[This also explains the problem with 's/<any_char>*/,/g' but of
>course this must not run into an endless loop.]
>
>Wolfgang Denk
>
>--
>Software Engineering: Embedded and Realtime Systems, Embedded Linux
>Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de
>Uncertain fortune is thoroughly mastered by the equity of the calcu-
>lation. - Blaise Pascal
More information about the busybox
mailing list