bug#70511: Option to grep into compressed files

2024-05-06 Thread Dale R. Worley
Mary via Bug reports for GNU grep writes: > Dale R. Worley wor...@alum.mit.edu wrote: >> [...] > I already have a patch that I believe is trivial enough to not cause > copyright concerns, would you like me to send it? *I* am all in favor of it, but I'm not a grep maintainer! Dale

bug#70511: Option to grep into compressed files

2024-05-04 Thread Mary via Bug reports for GNU grep
Dale R. Worley wor...@alum.mit.edu wrote: > I missed those facts. I only skimmed the section of > http://www.nongnu.org/zutils/manual/zutils_manual.html about Zcat and > hadn't read the "Common options" section which makes those clear. I'll > have to remember that zcat has this nice functionality.

bug#70511: Option to grep into compressed files

2024-05-01 Thread Dale R. Worley
Antonio Diaz Diaz writes: > Dale R. Worley wrote: >> So the construction I'm thinking of would be >> >> grep ... --use-compress-program=zcat ... pattern file ... > Zcat does indeed accept (and ignore) option -d for compatibility with gzip. > Therefore all that is needed is to implement a

bug#70511: Option to grep into compressed files

2024-04-30 Thread Antonio Diaz Diaz
Dale R. Worley wrote: So the construction I'm thinking of would be grep ... --use-compress-program=zcat ... pattern file ... Ah! interesting. Zgrep duplicates some of the work of grep. For example it recurses through directories, feeds grep one file at a time, and prepends the file

bug#70511: Option to grep into compressed files

2024-04-28 Thread Dale R. Worley
Antonio Diaz Diaz writes: > Dale R. Worley wrote: >> What doesn't seem to exist is something that does step 2 in a general >> way. The tool that is needed is something that reads the first few >> bytes of a file, determines which compression signature is present if >> any, then processes the

bug#70511: Option to grep into compressed files

2024-04-26 Thread Mary via Bug reports for GNU grep
> For a while, new options were getting added to GNU tar frequently in order > to allow you to do things like > > compress -dc | tar xf - > zcat | tar xf - > bzcat | tar xf - > lzcat | tar xf - > > etc., but just using the single tar invocation without (explicitly > running) an external

bug#70511: Option to grep into compressed files

2024-04-26 Thread Antonio Diaz Diaz
Dale R. Worley wrote: What doesn't seem to exist is something that does step 2 in a general way. The tool that is needed is something that reads the first few bytes of a file, determines which compression signature is present if any, then processes the contents through the correct decompressor.

bug#70511: Option to grep into compressed files

2024-04-25 Thread Seth David Schoen
Dale R. Worley writes: > What doesn't seem to exist is something that does step 2 in a general > way. The tool that is needed is something that reads the first few > bytes of a file, determines which compression signature is present if > any, then processes the contents through the correct

bug#70511: Option to grep into compressed files

2024-04-25 Thread Dale R. Worley
People have mentioned that it's best for a utility "to do one thing well". It seems to me that even the existing grep options do three things (in the complex use cases): - select a set of files - uncompress the files (if they're compressed) - search within the file contents I am ignoring the

bug#70511: Option to grep into compressed files

2024-04-24 Thread Mary via Bug reports for GNU grep
> 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

bug#70511: Option to grep into compressed files

2024-04-23 Thread David G. Pickett
Shell scripting can take file names in from a find or ls with 'while read', or by globbing 'for f in pattern', and examine them one by one, run 'grep -q' to find out if the file or uncompressed stream from that file has a match, and if so 'echo' the file name out, or if you want lines, it can

bug#70511: Option to grep into compressed files

2024-04-23 Thread jackson
Paul Eggert wrote: > I have some qualms though, as the new option would increase the attack > surface for 'grep', Agreed. Given the recent uproar involving liblzma being linked into ssh in systemd builds, resulting in a potentially very dangerous ssh compromise ... ... I would think that

bug#70511: Option to grep into compressed files

2024-04-23 Thread Dennis Clarke via Bug reports for GNU grep
On 4/23/24 11:21, Mary via Bug reports for GNU grep wrote: Thanks for the suggestion. You're right, this would be better than zgrep etc. 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

bug#70511: Option to grep into compressed files

2024-04-23 Thread Mary via Bug reports for GNU grep
> Thanks for the suggestion. You're right, this would be better than zgrep > etc. > > I have some qualms though, as the new option would increase the attack > surface for 'grep', in that you could then execute arbitrary code by > passing certain options to 'grep'. Is there some safer way to get

bug#70511: Option to grep into compressed files

2024-04-22 Thread David G. Pickett
One supposes that if the file extension is not trustworthy, one can taste file like the file command, and use libraries like the gzip libraries to handle gzipped files as a stream.  There are so many others: zip files could be treated like directories and all the files in them that match the

bug#70511: Option to grep into compressed files

2024-04-22 Thread Paul Eggert
Thanks for the suggestion. You're right, this would be better than zgrep etc. I have some qualms though, as the new option would increase the attack surface for 'grep', in that you could then execute arbitrary code by passing certain options to 'grep'. Is there some safer way to get what you

bug#70511: Option to grep into compressed files

2024-04-22 Thread Mary via Bug reports for GNU grep
Hello, I added an option to grep that filters files through a specified program. The main purpose for that is to uncompress files using the zcat (or `gzip -d`) command, or an equivalent for another compression format. It works like this: grep -j zcat pattern textfile.gz [textfile2.gz...]