Bill Allombert on Mon, 09 Sep 2024 23:35:43 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PATCH 2.16.2-beta] compressed input


On Sun, Sep 08, 2024 at 02:14:02PM +0200, Bill Allombert wrote:
> On Thu, Aug 29, 2024 at 05:54:39PM -0700, Ilya Zakharevich wrote:
> > This patch
> >   • allows newer types of compression of input;
> >   • protects against poison pills in the decompression command line.
> > 
> > Enjoy,
> > Ilya
> > 
> > +typedef struct 
> > +{
> > +  char *ext;
> > +  char *cmd;  
> > +} decompress_tbl;
> > +decompress_tbl decompress[] = {
> > +#ifdef ZCAT
> > +  {".Z",  ZCAT},
> > +#ifdef GZCAT
> > +  {".gz", ZCAT},
> > +#endif	/* defined GZCAT */ 
> > +#endif	/* defined ZCAT */ 
> > +  {".bz2",  "bzip2 -dc"},
> > +  {".xz",      "xz -dc"},
> > +  {".zstd",  "zstd -dc"},
> > +  {".7z",     "7za -so e"},
> > +  {".zip",  "unzip -p"},
> > +  {NULL, NULL}
> > +};
> 
> You could also add lzma, lz and lzop.
> Someone should really write a tool that provide consistent interface to all those.
> PARI/GP is not the place to do it...

I found some: zutils
https://download.savannah.gnu.org/releases/zutils/
This provide an universal zcat.  (Also exist acat and bsdcat)

However, we need a way to tell GP which extensions denote compressed files.
Mayeb we just need to add a new default ?

Cheers,
Bill.