[Bug 4520] New: grep -w fails when pattern is a strict substring of a word

bugzilla at busybox.net bugzilla at busybox.net
Wed Nov 23 20:14:28 UTC 2011


https://bugs.busybox.net/show_bug.cgi?id=4520

           Summary: grep -w fails when pattern is a strict substring of a
                    word
           Product: Busybox
           Version: 1.19.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P5
         Component: Standard Compliance
        AssignedTo: unassigned at busybox.net
        ReportedBy: anonym at lavabit.com
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0


It seems whenever busybox grep -w finds the pattern as a strict substring of a
word but then sees that it's not enclosed by symbols that delimit words, the
whole line is discarded. As a result, grep won't find the pattern when it
occurs as a word later in the line, and hence won't match the line.

Examples:

# the good cases that work as expected:
echo "a" | busybox grep -w a
a
echo "b,a" | busybox grep -w a
b,a

# the bad cases which should match but doesn't:
echo "ab,a" | busybox grep -w a
<no match>
echo "ba,a" | busybox grep -w a
<no match>
echo "bab,a" | busybox grep -w a
<no match>

Shouldn't `grep -w ${X}` be equivalent to `grep -e "\<${X}\>"` (the latter
works fine in busybox's grep)? At least that seems to be the case in GNU grep,
and is explicitly the case in BSD grep according to its manual.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list