GNU bug report logs -
#70511
Option to grep into compressed files
Previous Next
Full log
View this message in rfc822 format
> 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?
This bug report was last modified 1 year and 39 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.