[issue43547] support ZIP files with zeroed out fields (e.g. for reproducible builds)

Felix C. Stegerman report at bugs.python.org
Tue Mar 23 11:26:22 EDT 2021


Felix C. Stegerman <flx at obfusk.net> added the comment:

> The __getattr__ hack is not needed. You can reset the flags in a different, more straight forward way

As mentioned, ZipFile._open_to_write() will modify the ZipInfo's .external_attr when it is set to 0.

> I just found another specific example in _open_to_write().  0 is a valid value for zinfo.external_attr.  But this code always forces 0 to something else:
>
>     if not zinfo.external_attr:
>         zinfo.external_attr = 0o600 << 16  # permissions: ?rw-------

Your alternative doesn't seem to take that subsequent modification into account.

----------

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


More information about the Python-bugs-list mailing list