Summary: | [PATCH] bsdgrep(1): xzgrep(1) sometimes doesn't find matches it should find | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Antoine Brodin <antoine> | ||||||
Component: | bin | Assignee: | Xin LI <delphij> | ||||||
Status: | Closed FIXED | ||||||||
Severity: | Affects Some People | CC: | bdrewery, delphij, emaste, feld, gabor, gavin, pfg, pi, shoesoft | ||||||
Priority: | Normal | ||||||||
Version: | 10.0-RELEASE | ||||||||
Hardware: | Any | ||||||||
OS: | Any | ||||||||
Attachments: |
|
Description
Antoine Brodin
2014-02-18 09:50:00 UTC
I can reproduce that bug on 10-STABLE. xzgrep only works on the first 32K (uncompressed) of the input file. $ seq 10000 | xz > seq.xz $ xzgrep -c . seq.xz 6775 Using regular grep works as expected: $ xzcat seq.xz | grep -c . 10000 zgrep/bz2grep also work. *** Bug 194016 has been marked as a duplicate of this bug. *** Created attachment 147810 [details]
patch to fix xzgrep
Here's an attempt to fix xzgrep for files > 32KB.
Seems to work basically, but not much testing done yet.
Testing/Review welcome.
Created attachment 147858 [details]
improved patch
improved version of the patch:
* laction must be initialized to LZMA_RUN for each new file
* allocate lin_buf on heap (avoids wasting 32KB if we're not using xz)
A commit references this bug: Author: delphij Date: Wed Jan 21 01:11:38 UTC 2015 New revision: 277463 URL: https://svnweb.freebsd.org/changeset/base/277463 Log: Fix xz handling for files larger than 32K. Submitted by: Stefan Ehmann <shoesoft gmx net> PR: bin/186861 MFC after: 2 weeks Changes: head/usr.bin/grep/file.c (In reply to Stefan Ehmann from comment #5) I have committed your original patch plus setting laction = LZMA_RUN. Thanks for your submission! A commit references this bug: Author: delphij Date: Wed Feb 4 00:45:03 UTC 2015 New revision: 278175 URL: https://svnweb.freebsd.org/changeset/base/278175 Log: MFC r277463: Fix xz handling for files larger than 32K. Submitted by: Stefan Ehmann <shoesoft gmx net> PR: bin/186861 Changes: _U stable/10/ stable/10/usr.bin/grep/file.c A commit references this bug: Author: delphij Date: Wed Feb 4 00:45:29 UTC 2015 New revision: 278176 URL: https://svnweb.freebsd.org/changeset/base/278176 Log: MFC r277463: Fix xz handling for files larger than 32K. Submitted by: Stefan Ehmann <shoesoft gmx net> PR: bin/186861 Changes: _U stable/9/usr.bin/grep/ stable/9/usr.bin/grep/file.c Fix applied, thanks for your submission! |