On Wed, Sep 10, 2008 at 1:45 PM, Natanael Copa <[EMAIL PROTECTED]> wrote:
> After upgrade to busybox 1.12 shorewall failed to start. A user tracked
> it down to this line: grep '^[[:space:]]*$'
>
> I found out that busybox with CONFIG_EXTRA_COMPAT enabled did this:
>
> echo " " | busybox grep '^[[:space:]]*$' ; echo $?
> 1
>
> while gnu grep does:
>
> echo " " | grep '^[[:space:]]*$' ; echo $?
> 0
>
> Turning CONFIG_EXTR_COMPAT off makes busybox behave as gnu grep. Was
> this intentional or is it a bug? maybe its a bug in uclibc-0.9.28.3?
CONFIG_EXTR_COMPAT uses GNU regex matching, otherwise POSIX one is used:
#if !ENABLE_EXTRA_COMPAT
regexec(&gl->compiled_regex,
line, 1, &gl->matched_range, 0) == 0
#else
re_search(&gl->compiled_regex,
line, line_len,
/*start:*/ 0,
/*range:*/ line_len,
&gl->matched_range) >= 0
#endif
GNU regex matching can handle embedded NULs, POSIX one cannot.
Otherwise, I think they should be identical.
This is either a bug in uclibc or maybe your uclibc was built
with some option off or with "wrong" regex (uclibc has two, "new"
and "old").
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox