GNU bug report logs - #32903
[PATCH] Display uncompressed size when testing

Previous Next

Package: gzip;

Reported by: Stephen Kitt <steve <at> sk2.org>

Date: Tue, 2 Oct 2018 06:51:02 UTC

Severity: normal

Tags: patch

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32903 in the body.
You can then email your comments to 32903 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gzip <at> gnu.org:
bug#32903; Package gzip. (Tue, 02 Oct 2018 06:51:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stephen Kitt <steve <at> sk2.org>:
New bug report received and forwarded. Copy sent to bug-gzip <at> gnu.org. (Tue, 02 Oct 2018 06:51:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stephen Kitt <steve <at> sk2.org>
To: bug-gzip <at> gnu.org
Cc: Stephen Kitt <steve <at> sk2.org>
Subject: [PATCH] Display uncompressed size when testing
Date: Tue,  2 Oct 2018 08:49:29 +0200
Alongside the OK message, print the real size in bytes; this provides
a way to view the stored file's size when it's larger than 4GiB.

Signed-off-by: Stephen Kitt <steve <at> sk2.org>
---
 gzip.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gzip.c b/gzip.c
index e6a7761..4104472 100644
--- a/gzip.c
+++ b/gzip.c
@@ -62,6 +62,7 @@ static char const *const license_msg[] = {
 #include <stddef.h>
 #include <sys/stat.h>
 #include <errno.h>
+#include <inttypes.h>
 
 #include "tailor.h"
 #include "gzip.h"
@@ -807,7 +808,7 @@ local void treat_stdin()
 
     if (verbose) {
         if (test) {
-            fprintf(stderr, " OK\n");
+            fprintf(stderr, " OK (%jd bytes)\n", (intmax_t) bytes_out);
 
         } else if (!decompress) {
             display_ratio(bytes_in-(bytes_out-header_bytes), bytes_in, stderr);
@@ -1060,7 +1061,7 @@ local void treat_file(iname)
     /* Display statistics */
     if(verbose) {
         if (test) {
-            fprintf(stderr, " OK");
+            fprintf(stderr, " OK (%jd bytes)", (int_max_t) bytes_out);
         } else if (decompress) {
             display_ratio(bytes_out-(bytes_in-header_bytes), bytes_out,stderr);
         } else {
-- 
2.11.0





Information forwarded to bug-gzip <at> gnu.org:
bug#32903; Package gzip. (Sun, 04 Nov 2018 17:22:03 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sergey Ponomarev <stokito <at> gmail.com>
To: bug-gzip <at> gnu.org
Subject: bug#32903: [PATCH] Display uncompressed size when testing
Date: Sun, 4 Nov 2018 14:49:50 +0200
[Message part 1 (text/plain, inline)]
> Alongside the OK message, print the real size in bytes; this provides
a way to view the stored file's size when it's larger than 4GiB.

You can get a real size by `gzip --list` command. Why to show the size in
`gzip --test` output? Almost all other compressors (lzop, xz, bzip2, etc0
just shows the same message:
filename: OK

Even more, archive manages and other tools may try to parse the test
command output and the change may have some impact.

> this provides a way to view the stored file's size when it's larger than
4GiB.
I didn't get it. Can you please elaborate on this: `gzip --list` can't show
uncompressed size more than 4GiB?

Regards, Sergey
[Message part 2 (text/html, inline)]

Information forwarded to bug-gzip <at> gnu.org:
bug#32903; Package gzip. (Sun, 04 Nov 2018 19:40:02 GMT) Full text and rfc822 format available.

Message #11 received at 32903 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Kitt <steve <at> sk2.org>
To: Sergey Ponomarev <stokito <at> gmail.com>
Cc: 32903 <at> debbugs.gnu.org
Subject: Re: bug#32903: [PATCH] Display uncompressed size when testing
Date: Sun, 4 Nov 2018 20:39:34 +0100
[Message part 1 (text/plain, inline)]
Hi Sergey,

On Sun, 4 Nov 2018 14:49:50 +0200, Sergey Ponomarev <stokito <at> gmail.com> wrote:
> > Alongside the OK message, print the real size in bytes; this provides  
> a way to view the stored file's size when it's larger than 4GiB.
> 
> You can get a real size by `gzip --list` command. Why to show the size in
> `gzip --test` output? Almost all other compressors (lzop, xz, bzip2, etc0
> just shows the same message:
> filename: OK

"gzip --list" only reports sizes correctly up to 4GiB; see the BUGS section in
the manpage:

       The  gzip  format represents the input size modulo 2^32, so the --list
       option reports incorrect uncompressed sizes and compression ratios
       for uncompressed files 4 GB and larger.

> Even more, archive manages and other tools may try to parse the test
> command output and the change may have some impact.

True, I haven’t checked the impact much — although I’ve been running gzip
with this patch for a while without adverse effects (but that’s anecdotal).

> > this provides a way to view the stored file's size when it's larger than  
> 4GiB.
> I didn't get it. Can you please elaborate on this: `gzip --list` can't show
> uncompressed size more than 4GiB?

See above.

Regards,

Stephen
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to bug-gzip <at> gnu.org:
bug#32903; Package gzip. (Sun, 04 Nov 2018 19:56:01 GMT) Full text and rfc822 format available.

Message #14 received at 32903 <at> debbugs.gnu.org (full text, mbox):

From: Sergey Ponomarev <stokito <at> gmail.com>
To: steve <at> sk2.org
Cc: 32903 <at> debbugs.gnu.org
Subject: Re: bug#32903: [PATCH] Display uncompressed size when testing
Date: Sun, 4 Nov 2018 21:54:59 +0200
[Message part 1 (text/plain, inline)]
Thanks for explanation,

From user point of view it would be better not to enclose the size
into brackets: it will be easier to parse the output by other tools.

On Sun, 4 Nov 2018 at 21:39, Stephen Kitt <steve <at> sk2.org> wrote:

> Hi Sergey,
>
> On Sun, 4 Nov 2018 14:49:50 +0200, Sergey Ponomarev <stokito <at> gmail.com>
> wrote:
> > > Alongside the OK message, print the real size in bytes; this provides
> > a way to view the stored file's size when it's larger than 4GiB.
> >
> > You can get a real size by `gzip --list` command. Why to show the size in
> > `gzip --test` output? Almost all other compressors (lzop, xz, bzip2, etc0
> > just shows the same message:
> > filename: OK
>
> "gzip --list" only reports sizes correctly up to 4GiB; see the BUGS
> section in
> the manpage:
>
>        The  gzip  format represents the input size modulo 2^32, so the
> --list
>        option reports incorrect uncompressed sizes and compression ratios
>        for uncompressed files 4 GB and larger.
>
> > Even more, archive manages and other tools may try to parse the test
> > command output and the change may have some impact.
>
> True, I haven’t checked the impact much — although I’ve been running gzip
> with this patch for a while without adverse effects (but that’s anecdotal).
>
> > > this provides a way to view the stored file's size when it's larger
> than
> > 4GiB.
> > I didn't get it. Can you please elaborate on this: `gzip --list` can't
> show
> > uncompressed size more than 4GiB?
>
> See above.
>
> Regards,
>
> Stephen
>


-- 
Sergey Ponomarev <https://linkedin.com/in/stokito>, skype:stokito
[Message part 2 (text/html, inline)]

Information forwarded to bug-gzip <at> gnu.org:
bug#32903; Package gzip. (Mon, 24 Dec 2018 09:23:02 GMT) Full text and rfc822 format available.

Message #17 received at 32903 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Kitt <steve <at> sk2.org>
To: Sergey Ponomarev <stokito <at> gmail.com>
Cc: 32903 <at> debbugs.gnu.org
Subject: Re: bug#32903: [PATCH] Display uncompressed size when testing
Date: Mon, 24 Dec 2018 10:21:58 +0100
[Message part 1 (text/plain, inline)]
On Sun, 4 Nov 2018 21:54:59 +0200, Sergey Ponomarev <stokito <at> gmail.com> wrote:
> From user point of view it would be better not to enclose the size
> into brackets: it will be easier to parse the output by other tools.

Good point, here’s an updated patch (I hesitated between "xxx bytes OK" and
"OK xxx bytes" but went with the latter in the end).

Regards,

Stephen

    Display uncompressed size when testing
    
    Alongside the OK message, print the real size in bytes; this provides
    a way to view the stored file's size when it's larger than 4GiB.
    
    Signed-off-by: Stephen Kitt <steve <at> sk2.org>

diff --git a/gzip.c b/gzip.c
index e6a7761..a162154 100644
--- a/gzip.c
+++ b/gzip.c
@@ -62,6 +62,7 @@ static char const *const license_msg[] = {
 #include <stddef.h>
 #include <sys/stat.h>
 #include <errno.h>
+#include <inttypes.h>
 
 #include "tailor.h"
 #include "gzip.h"
@@ -807,7 +808,7 @@ local void treat_stdin()
 
     if (verbose) {
         if (test) {
-            fprintf(stderr, " OK\n");
+            fprintf(stderr, " OK %jd bytes\n", (intmax_t) bytes_out);
 
         } else if (!decompress) {
             display_ratio(bytes_in-(bytes_out-header_bytes), bytes_in, stderr);
@@ -1060,7 +1061,7 @@ local void treat_file(iname)
     /* Display statistics */
     if(verbose) {
         if (test) {
-            fprintf(stderr, " OK");
+            fprintf(stderr, " OK %jd bytes", (int_max_t) bytes_out);
         } else if (decompress) {
             display_ratio(bytes_out-(bytes_in-header_bytes), bytes_out,stderr);
         } else {
[Message part 2 (application/pgp-signature, inline)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Wed, 30 Mar 2022 00:15:02 GMT) Full text and rfc822 format available.

Notification sent to Stephen Kitt <steve <at> sk2.org>:
bug acknowledged by developer. (Wed, 30 Mar 2022 00:15:02 GMT) Full text and rfc822 format available.

Message #22 received at 32903-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Stephen Kitt <steve <at> sk2.org>
Cc: 32903-done <at> debbugs.gnu.org
Subject: Re: [PATCH] Display uncompressed size when testing
Date: Tue, 29 Mar 2022 17:14:27 -0700
We've recently changed 'gzip -l' so that it displays the correct 
uncompressed size, and this change should appear in the next gzip release.

As that seemed to be the primary motivation for suggesting 'gzip -t' to 
display the size, I'm taking the liberty of closing Bug#32903 dated 
2018-10-02.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 27 Apr 2022 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years ago.

Previous Next


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