Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Sep 2011 10:38:29 +0900
From:      poyopoyo@puripuri.plala.or.jp
To:        freebsd-current@FreeBSD.org
Subject:   bsdgrep: does anyone see this?
Message-ID:  <86ipoqsk8a.wl%poyopoyo@puripuri.plala.or.jp>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86ipoqsk8a.wl%poyopoyo>