[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#70511: Option to grep into compressed files
From: |
Mary |
Subject: |
bug#70511: Option to grep into compressed files |
Date: |
Wed, 24 Apr 2024 02:26:03 +0000 |
> Do you know zgrep from zutils?
TIL! My system does not come with those by default, and instead provides a
`zgrep` that is a Bash script supporting only `gzip`.
Are those the generally recommended tools to use? (I'm not sure why
`zgrep`/`bzgrep`/`xzgrep` would be provided by their respective projects, given
the existence of this project.)
> What happened to the old UNIX concept of
>
> Do one thing.
> Do it well.
> Then stop.
>
> To grep a compressed stream of bits you just pass the decompressed
> bits along a pipe.
>
> Done.
I'm not sure what's the threshold for that principle. GNU grep implements a
certain number of options beyond POSIX ones. I decided to send my proposal
because I read here: https://www.gnu.org/software/grep/devel.html that GNU grep
planned to implement the `-Z` and `-J` options, though I'm not sure if that
page is still up-to-date.
As for the piping mechanism, it does work for simple cases, but it doesn't work
well with `--recursive`, or `--with-filename` for example. There are ways to
work around it with certain shells, but they tend to give long and complex
strings. They are generally better suited for ad hoc uses, and it's difficult
to make them portable.
> ... I would think that minimizing the attack surface on common commands
> by not linking in non-essential compression libraries would be a no brainer.
I agree with that. I only wanted to make life easier for the maintainers of
compression libraries. Perhaps it would be better security-wise to provide the
regular grep vanilla, but also provide on the side some "flavored" utilities
like `zgrep`/`bzgrep`/`xzgrep` which would be compiled against the relevant
libraries?
bug#70511: Option to grep into compressed files, David G. Pickett, 2024/04/23
bug#70511: Option to grep into compressed files, Antonio Diaz Diaz, 2024/04/26