[illumos-Developer] grep -Z etc? (decompress! was: webrev: 650 grep support for -q ...)

Attila Fülöp atf at gesindel.org
Fri May 6 13:38:29 PDT 2011


On 05/ 6/11 05:53 AM, Albert Lee wrote:
> On Thu, May 5, 2011 at 10:52 PM, Yuri Pankov <yuri.pankov at gmail.com> wrote:
>> On Thu, May 05, 2011 at 10:21:09PM -0400, Gordon Ross wrote:
>>> I have mixed feelings about seeing uncompress support in grep.
>>> Perhaps that's useful, but it violates the Unix design principle of
>>> making tools that each do one thing well (or set of related things)
>>> and that can be easily combined to more complex thing.
>>>
>>> Am I just being old fashioned?
>>
>> Think of archives as just another type of file. grep's purpose is to
>> match lines in files (of different kind) and it does just that - using
>> those libraries to look inside compressed files. It is especially useful
>> when doing recursive grep. Just how I see it, anyway.
>>
> 
> The motivation here is that grep's design, and the design of Unix
> tools that traverse directory trees in general, is not sufficiently
> flexible to implement this with a filter.

Whats wrong with
find . -type f -exec gzgrep something {} \; -ls
or
find . -type f | xargs gzgrep something
if you want to have the filename prepended on every output line.

This will work like gnu grep -rZ, or am I overlooking  something?

-- Attila

>>> Note that these options cause grep to drag in
>>> libzlib and libbz2 for the decompress support.
>>> One of which is not in core illumos...
>>
>> Both of them aren't...
>>
>> $ grep -rE 'lib(z|bz2)\.so' usr/src/pkg/manifests/; echo $?
>> 1
>>
> 
> Right, common/bzip2 exists for static linking but wouldn't be the
> preferred form for most of userland. Actually zlib is really
> unfortunate, as there seem to be three private copies of it in the
> tree.
> 
> I've also mixed feelings about ON builds gain more external
> dependencies, even if they can be "easily" satisfied in this case.
> 
>> Anyway, disabling decompression will just need several #ifdef's..
>>
> 
> We should probably either take it or not, rather than leaving it to bitrot.
> 
> -Albert
> 
> _______________________________________________
> Developer mailing list
> Developer at lists.illumos.org
> http://lists.illumos.org/m/listinfo/developer
> 
> 




More information about the Developer mailing list