bsdgrep: xzgrep gives up searching too early

poyopoyo at puripuri.plala.or.jp poyopoyo at puripuri.plala.or.jp
Tue Feb 14 20:58:26 UTC 2012


This is -CURRENT of r231204, 9 Feb.

xzgrep seems to give up at first read().

$ yes a|head|xz|xzgrep -c a
10
$ yes a|head -100|xz|xzgrep -c a
100
$ yes a|head -10000|xz|xzgrep -c a
10000
$ yes a|head -100000|xz|xzgrep -c a
16384

bzgrep, zgrep and grep works as expected.

$ yes a|head|bzip2|bzgrep -c a
10
$ yes a|head -100|bzip2|bzgrep -c a
100
$ yes a|head -1000|bzip2|bzgrep -c a
1000
$ yes a|head -10000|bzip2|bzgrep -c a
10000
$ yes a|head -100000|bzip2|bzgrep -c a
100000
$ yes a|head -1000000|bzip2|bzgrep -c a
1000000
$ yes a|head -10000000|bzip2|bzgrep -c a
10000000

$ yes a|head|gzip|zgrep -c a
10
$ yes a|head -100|gzip|zgrep -c a
100
$ yes a|head -1000|gzip|zgrep -c a
1000
$ yes a|head -10000|gzip|zgrep -c a
10000
$ yes a|head -100000|gzip|zgrep -c a
100000
$ yes a|head -1000000|gzip|zgrep -c a
1000000
$ yes a|head -10000000|gzip|zgrep -c a
10000000

$ yes a|head|grep -c a
10
$ yes a|head -100|grep -c a
100
$ yes a|head -1000|grep -c a
1000
$ yes a|head -10000|grep -c a
10000
$ yes a|head -100000|grep -c a
100000
$ yes a|head -1000000|grep -c a
1000000
$ yes a|head -10000000|grep -c a
10000000

they are single binary (linked statically)

$ for f in xzgrep bzgrep zgrep grep; do ls -l $(which $f); done
-r-xr-xr-x  15 root  wheel  578352 Feb  2 00:39 /usr/bin/xzgrep*
-r-xr-xr-x  15 root  wheel  578352 Feb  2 00:39 /usr/bin/bzgrep*
-r-xr-xr-x  15 root  wheel  578352 Feb  2 00:39 /usr/bin/zgrep*
-r-xr-xr-x  15 root  wheel  578352 Feb  2 00:39 /usr/bin/grep*

-- 
kuro


More information about the freebsd-current mailing list