[New-bugs-announce] [issue35218] Impossible to round-trip decompress -> compress zipfiles with Python 3 due to losing flag_bits

keeely report at bugs.python.org
Mon Nov 12 09:38:21 EST 2018


New submission from keeely <smh at sophos.com>:

Python 2.7 allows one to capture from one file a list of ZipInfo objects, and then recreate a new file using those ZipInfo objects.  The same thing appears to be impossible with Python 3 without resorting to monkey-patches because of a line of code in the writestr() code path ignoring the passed in value of ZipInfo and overwritting it with zeros.

See:
https://github.com/python/cpython/blob/master/Lib/zipfile.py#L1567

See also a possible solution at:
https://stackoverflow.com/questions/53254622/zipfile-header-language-encoding-bit-set-differently-between-python2-and-python3

----------
components: Library (Lib)
messages: 329733
nosy: keeely
priority: normal
severity: normal
status: open
title: Impossible to round-trip decompress -> compress zipfiles with Python 3 due to losing flag_bits
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35218>
_______________________________________


More information about the New-bugs-announce mailing list