Actions
Bug #12273
openForward slash foils grep -w
Status:
New
Priority:
Normal
Assignee:
-
Category:
cmd - userland programs
Start date:
Due date:
% Done:
0%
Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:
Description
Investigating #12181, comparing the behavior of FreeBSD and GNU grep -w
to illumos grep -w
, it appears the leading / breaks things:
Illumos:
root@pi:/ws/illumos-gate/usr/src/lib/libc/port/regex (multilist)# echo "foo bar baz" | grep -w bar foo bar baz root@pi:/ws/illumos-gate/usr/src/lib/libc/port/regex (multilist)# echo "foo bar baz" | grep -w baz foo bar baz root@pi:/ws/illumos-gate/usr/src/lib/libc/port/regex (multilist)# echo "foo bar baz" | grep -w foo foo bar baz root@pi:/ws/illumos-gate/usr/src/lib/libc/port/regex (multilist)# echo "/foo bar baz" | grep -w /foo root@pi:/ws/illumos-gate/usr/src/lib/libc/port/regex (multilist)# echo "/foo bar baz" | /usr/gnu/bin/grep -w /foo /foo bar baz
On FreeBSD:
[jbk@syzygy ~]$ echo "foo bar baz" | grep -w bar foo bar baz [jbk@syzygy ~]$ echo "foo bar baz" | grep -w baz foo bar baz [jbk@syzygy ~]$ echo "foo bar baz" | grep -w foo foo bar baz [jbk@syzygy ~]$ echo "/foo bar baz" | grep -w foo /foo bar baz
Related issues
Updated by Jason King almost 4 years ago
To add more confusion: illumos grep(1) defines grep -w pattern
as equivalent to grep '\<pattern\>'
(this is how it's also implemented internally), however BSD grep(1) does not states this (nor does it implement -w
in that manner). In fact grep \<pattern\>
has the same behavior on BSD and illumos, including when pattern
begins with a /
. So it's still unclear what the correct behavior should be.
Updated by Jason King almost 4 years ago
- Related to Bug #12181: zvol tests should avoid grep -w added
Actions