GNU bug report logs - #45148
Piping into gzip --list -

Previous Next

Package: gzip;

Reported by: Stefano Marsili <efanomars <at> gmx.ch>

Date: Wed, 9 Dec 2020 19:38:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefano Marsili <efanomars <at> gmx.ch>
To: 45148 <at> debbugs.gnu.org
Subject: bug#45148: Piping into gzip --list -
Date: Wed, 9 Dec 2020 20:05:50 +0100
[Message part 1 (text/plain, inline)]
Hi,
I wanted to help the Debian project and found the gzip bug report

  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=575884

Despite not being a C programmer I decided to give it a try.
Since this is the first time I have a patch for an open source project,
I thought that maybe I should first ask upstream if it makes sense.

In the code of gzip.c there is the comment:

 * If the lseek fails, we could use read() to get to the end, but
 * --list is used to get quick results.
 * Use "gunzip < foo.gz | wc -c" to get the uncompressed size if
 * you are not concerned about speed.

Assuming it is correct, the patch does just that, use read() to get
to the end.
After applying the patch and running

  $ time cat rnd0.bin.gz | gzip -l -

on a gzipped 3GB file created with /dev/urandom, the result is

   compressed        uncompressed  ratio uncompressed_name
   3000485948          3000000000  -0.0% stdout

   real   0m0.740s
   user   0m0.013s
   sys    0m1.134s

To me it seems quite fast, but maybe gzip is used with much bigger
files and one second is too slow.

The patch is attached to this e-mail.
I'd like to know what you think about it.
Thanks
 
 
[pipetolist.diff (text/x-patch, attachment)]

This bug report was last modified 3 years and 134 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.