Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of writing to unseekable file in zipfile #67441

Closed
serhiy-storchaka opened this issue Jan 16, 2015 · 6 comments
Closed

Add support of writing to unseekable file in zipfile #67441

serhiy-storchaka opened this issue Jan 16, 2015 · 6 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Jan 16, 2015

BPO 23252
Nosy @bitdancer, @serhiy-storchaka
Files
  • zipfile_write_unseekable.patch
  • 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:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2015-03-23.08:35:07.357>
    created_at = <Date 2015-01-16.19:55:48.019>
    labels = ['type-feature', 'library']
    title = 'Add support of writing to unseekable file in zipfile'
    updated_at = <Date 2016-02-02.17:23:08.630>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2016-02-02.17:23:08.630>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2015-03-23.08:35:07.357>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2015-01-16.19:55:48.019>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['37970']
    hgrepos = []
    issue_num = 23252
    keywords = ['patch']
    message_count = 6.0
    messages = ['234145', '235184', '236360', '238951', '259274', '259406']
    nosy_count = 5.0
    nosy_names = ['r.david.murray', 'python-dev', 'Matt.Mackall', 'serhiy.storchaka', 'Patrik Dufresne']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue23252'
    versions = ['Python 3.5']

    @serhiy-storchaka
    Copy link
    Member Author

    serhiy-storchaka commented Jan 16, 2015

    ZIP files can be created to transfer it via unseekable streams (pipes, sockets). Mercurial uses a workaround to write ZIP files right to wsgirequest, but this is possible only with writestr(). write() needs seek() to updated file size, compressed sized and CRC. However ZIP file format supports streamed data without writing sizes and CRC before file data. It is possible and desirable to add full support of unseekable output files in zipfile.

    @serhiy-storchaka serhiy-storchaka self-assigned this Jan 16, 2015
    @serhiy-storchaka serhiy-storchaka added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Jan 16, 2015
    @serhiy-storchaka
    Copy link
    Member Author

    serhiy-storchaka commented Feb 1, 2015

    Here is a patch. Mercurial wouldn't need a wrapper in Python 3.5.

    @serhiy-storchaka
    Copy link
    Member Author

    serhiy-storchaka commented Feb 21, 2015

    Could you please make a review of the documentation part of the patch David?

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 22, 2015

    New changeset 19f36a2a34ec by Serhiy Storchaka in branch 'default':
    Issue bpo-23252: Added support for writing ZIP files to unseekable streams.
    https://hg.python.org/cpython/rev/19f36a2a34ec

    @PatrikDufresne
    Copy link
    Mannequin

    PatrikDufresne mannequin commented Jan 31, 2016

    While this path provide support to create Zip file for non-seekable stream. It doesn't support reading a file from a non-seekable stream.

    @serhiy-storchaka
    Copy link
    Member Author

    serhiy-storchaka commented Feb 2, 2016

    Currently the zipfile module requires seekable stream to read a list of entries from central directory at the end of ZIP file, and for reding their content in arbitrary order. The support of unseekable stream needs to design a new API. This is separate issue.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant