Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Apr 2017 23:19:06 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 105221] grep(1): `grep -w -F ""` issue
Message-ID:  <bug-105221-8-rrHvhH31ay@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-105221-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-105221-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D105221

Kyle Evans <bsdports@kyle-evans.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bsdports@kyle-evans.net,
                   |                            |emaste@freebsd.org

--- Comment #3 from Kyle Evans <bsdports@kyle-evans.net> ---
Some notes:

bsdgrep(1) is also affected in a different way by this old, old bug, so some
notes:

gnugrep currently in base still exhibits the original behavior
bsdgrep will match the string
textproc/gnugrep will fail to match, presumably because it matches the 0-le=
ngth
BOL at the beginning of the string and the character immediately following =
it
("q") is a word character

Here's some other interesting behavior from textproc/gnugrep:

$ echo "" | fgrep -w ""

# Empty string, exit =3D 0, OK, that's..interesting
$ echo "qaz" | fgrep -w ""
# exit =3D 1, expected
$ echo " qaz" | fgrep -w ""
 qaz
$ printf "" | fgrep -w ""
# exit =3D 1, expected

On one hand, I don't agree with the idea that a 0-length match can *ever*
produce a whole-word match- this seems misleading and probably not a practi=
cal
use case.

On the other hand, this is technically correct behavior because the 0-length
match is at the beginning of the string with a non-word-character on its ot=
her
side.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-105221-8-rrHvhH31ay>