[PATCH] grep: properly handle grep -w "^str"

Bartosz Gołaszewski bartekgola at gmail.com
Fri Feb 7 14:26:31 UTC 2014


2014-02-07 Denys Vlasenko <vda.linux at googlemail.com>:
> On Thu, Feb 6, 2014 at 9:34 PM, Bartosz Golaszewski
> <bartekgola at gmail.com> wrote:
>> Pass the REG_NOTBOL flag to subsequent regexec calls.
>
> Which use case it fixes?
> I would like to add it to testsuite.

It's already there:

testing "grep -w ^str doesn't match str not at the beginning" \
        "grep -w ^str input" \
        "" \
        "strstr\n" \
        ""

and

commit cd55f2d9332489432ba2b3093903949c6c2e3e33
Author: Denys Vlasenko <vda.linux at googlemail.com>
Date:   Tue Jan 7 14:57:42 2014 +0100

    grep: fix two bugs with -w

    Unfortunately, with !EXTRA_COMPAT, "grep -w ^str" still
erroneously matches "strstr".

Best regards,
Bartosz Golaszewski


More information about the busybox mailing list