From: Philipp Gesang Date: Tue, 25 Apr 2017 12:03:36 +0000 (+0200) Subject: properly (re-) initialize compressor at archive / volume bounds X-Git-Tag: v2.2~7^2~146 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=8ae983c4f680de929726c5a17340f8b0231a9c9d;p=python-delta-tar properly (re-) initialize compressor at archive / volume bounds For unencrypted streams, the compressor still must be reset in concat mode. For encrypted streams, the decompressor can be initialized right at the start of the archive since no further inputs are needed. --- diff --git a/deltatar/tarfile.py b/deltatar/tarfile.py index e3659a3..78fdad8 100644 --- a/deltatar/tarfile.py +++ b/deltatar/tarfile.py @@ -463,8 +463,7 @@ class _Stream: self.zlib = zlib if mode == "r": self.exception = zlib.error - if self.encryption is None: - self._init_read_gz() + self._init_read_gz() elif mode == "w": if self.encryption is None and concat_stream is False: self._init_write_gz () @@ -2515,7 +2514,8 @@ class TarFile(object): if getattr (self.fileobj, "encryption", None) is not None: self.fileobj._init_write_encrypt (tarinfo.name) - if getattr (self.fileobj, "cmp", None) is not None: + if self.concat_compression or \ + getattr (self.fileobj, "cmp", None) is not None: self.fileobj._init_write_gz () # write new volume header