Hello,

 

I'm sending a patch to grep which was not working correctly when
multiple patterns were used.

In the main searching loop the program read a line of text and then in
an inner loop it tried to match against each of the patterns. However,
if a match were found it didn't stop the inner loop, in a way that only
the last pattern was honored. The patched just added a 'break' to this
loop.

 

The bug was only visible when using -F flag (literal matching) because
the variable 'ret' was never reset when this flag was not passed (normal
regexp matching).

 

In order to experience the bug, try 'grep -F -e "txt1" -e "txt2"
input.txt', where input.txt is:

--------

txt1

txt2

--------

The output will be 'txt2' only.

 

Regards,

 

Rogerio

 

Attachment: grep.patch
Description: grep.patch

_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to