python / cpython

The Python programming language
https://www.python.org
Other
63.72k stars 30.53k forks source link

zipfile: does not include optional descriptor signature #78653

Closed 06cacd76-a17f-48cc-a67b-eab6bc60ed68 closed 6 years ago

06cacd76-a17f-48cc-a67b-eab6bc60ed68 commented 6 years ago
BPO 34472
Nosy @serhiy-storchaka, @silas
PRs
  • python/cpython#8871
  • python/cpython#9398
  • python/cpython#9399
  • python/cpython#9407
  • Files
  • zip_stream_example.py: Example code showing issue
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = None closed_at = created_at = labels = ['3.7', '3.8', 'type-bug', 'library'] title = 'zipfile: does not include optional descriptor signature' updated_at = user = 'https://github.com/silas' ``` bugs.python.org fields: ```python activity = actor = 'serhiy.storchaka' assignee = 'none' closed = True closed_date = closer = 'serhiy.storchaka' components = ['Library (Lib)'] creation = creator = 'silas' dependencies = [] files = ['47760'] hgrepos = [] issue_num = 34472 keywords = ['patch'] message_count = 6.0 messages = ['323943', '325664', '325667', '326101', '326104', '326105'] nosy_count = 2.0 nosy_names = ['serhiy.storchaka', 'silas'] pr_nums = ['8871', '9398', '9399', '9407'] priority = 'normal' resolution = 'fixed' stage = 'resolved' status = 'closed' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue34472' versions = ['Python 2.7', 'Python 3.6', 'Python 3.7', 'Python 3.8'] ```

    06cacd76-a17f-48cc-a67b-eab6bc60ed68 commented 6 years ago

    When adding a fileobj that is not seekable to a zip using the zipfile module, the optional signature value 0x08074b50 is not included. This breaks certain zip implementations, including the builtin MacOS Archive Utility.

    See https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT sections 4.3.9.3 and 4.3.9.4

    serhiy-storchaka commented 6 years ago

    New changeset 4ba3b50bfe6d50cd82d208023ea23e203ab50589 by Serhiy Storchaka (Silas Sewell) in branch 'master': bpo-34472: Add data descriptor signature to zipfile (GH-8871) https://github.com/python/cpython/commit/4ba3b50bfe6d50cd82d208023ea23e203ab50589

    serhiy-storchaka commented 6 years ago

    Thank you for your contribution Silas.

    Since popular ZIP file implementation like Info-ZIP and Java write this signature unconditionally, I think most unzipping software support it if they support reading ZIP files in streaming mode at all, at it is safe to backport this change to all maintained versions.

    serhiy-storchaka commented 6 years ago

    New changeset 6ec298114855b648a1f5fc4188ea3686a9d77fb3 by Serhiy Storchaka in branch '2.7': [2.7] bpo-34472: Add data descriptor signature to zipfile (GH-8871) (ПР-9407) https://github.com/python/cpython/commit/6ec298114855b648a1f5fc4188ea3686a9d77fb3

    serhiy-storchaka commented 6 years ago

    New changeset ed21919d69ac22232cbc0dad0323477818112b6f by Serhiy Storchaka (Miss Islington (bot)) in branch '3.6': bpo-34472: Add data descriptor signature to zipfile (GH-8871) (GH-9398) https://github.com/python/cpython/commit/ed21919d69ac22232cbc0dad0323477818112b6f

    serhiy-storchaka commented 6 years ago

    New changeset 44989bc2696320cf55ae6f329aaf58edd49d792a by Serhiy Storchaka (Miss Islington (bot)) in branch '3.7': bpo-34472: Add data descriptor signature to zipfile (GH-8871) (GH-9399) https://github.com/python/cpython/commit/44989bc2696320cf55ae6f329aaf58edd49d792a