]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
xz: Fix displaying of file sizes in progress indicator in passthru mode.
authorLasse Collin <lasse.collin@tukaani.org>
Wed, 9 Nov 2022 10:48:22 +0000 (12:48 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Fri, 11 Nov 2022 11:48:06 +0000 (13:48 +0200)
It worked for one input file since the counters are zero when
xz starts but they weren't reset when starting a new file in
passthru mode. For example, if files A, B, and C are one byte each,
then "xz -dcvf A B C" would show file sizes as 1, 2, and 3 bytes
instead of 1, 1, and 1 byte.

src/xz/coder.c

index 51cd3ef0d12f1ad7664b65b7da08e899ee89f87c..f952e80db9cfcbb4d51ec1e623e4e6d0240d8bc0 100644 (file)
@@ -513,8 +513,12 @@ coder_init(file_pair *pair)
                        // is needed, because we don't want to do use
                        // passthru mode with --test.
                        if (opt_mode == MODE_DECOMPRESS
-                                       && opt_stdout && opt_force)
+                                       && opt_stdout && opt_force) {
+                               // These are needed for progress info.
+                               strm.total_in = 0;
+                               strm.total_out = 0;
                                return CODER_INIT_PASSTHRU;
+                       }
 
                        ret = LZMA_FORMAT_ERROR;
                        break;