[BusyBox] BusyBox SED bugs reproducible at will.

Wolfgang Denk wd at denx.de
Mon Mar 18 13:49:03 UTC 2002


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