bsdgrep: does anyone see this?

poyopoyo at puripuri.plala.or.jp poyopoyo at puripuri.plala.or.jp
Sun Sep 18 01:38:32 UTC 2011


Hi,

On the latest -CURRENT of r225642 built with single line
"WITH_BSD_GREP=yes" in src.conf,

$ type -a grep
grep is /usr/bin/grep
$ grep -V
grep (BSD grep) 2.5.1-FreeBSD
$ locale
LANG=
LC_CTYPE="C"
LC_COLLATE="C"
LC_TIME=C
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES=C
LC_ALL=
$ echo |grep -q '^'; echo $?
1
$ echo |grep -qv '^'; echo $?
0
$ echo |gnugrep -q '^'; echo $?
0
$ echo |gnugrep -qv '^'; echo $?
1
I believe GNU grep is correct, and bsdgrep inverts logic when input is
a newline. Imagine my astonishment when yes ""|grep -v '^$' scrolled
out console text instantly. :)

I also tested stock GNU grep on RELENG_8 chroot sandbox,
bsd-grep-20110912 from ports on both RELENG_8 and 9-CURRENT, and found
they work all OK as GNU grep. So I think this has been fixed in the
latest bsdgrep but not checked in to -CURRENT yet. Am I correct? Does
anyone see this on your 9-CURRENT box?

-- 
kuro


More information about the freebsd-current mailing list