Bug 194016 - xzgrep doesn't process the entire file
Summary: xzgrep doesn't process the entire file
Status: Closed DUPLICATE of bug 186861
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-29 14:24 UTC by Mark Felder
Modified: 2014-09-29 14:28 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Felder freebsd_committer freebsd_triage 2014-09-29 14:24:38 UTC
As reported on the mailing lists in 2012, and resurfaced recently:

http://lists.freebsd.org/pipermail/freebsd-current/2012-February/031896.html
http://lists.freebsd.org/pipermail/freebsd-stable/2014-September/080172.html


Original message below
----

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
Comment 1 Mark Felder freebsd_committer freebsd_triage 2014-09-29 14:28:52 UTC
gjb pointed me to a duplicate.

*** This bug has been marked as a duplicate of bug 186861 ***