Skip to content

zipfile truncates extracted files #64542

Closed

Description

@ChristianPrez
BPO 20343
Nosy @serhiy-storchaka
Superseder
  • bpo-20048: zipfile's readline() drops data in universal newline mode
  • 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 = None
    closed_at = <Date 2014-01-22.13:07:00.819>
    created_at = <Date 2014-01-22.11:05:09.495>
    labels = ['type-bug', 'library']
    title = 'zipfile truncates extracted files'
    updated_at = <Date 2014-01-22.13:10:17.829>
    user = 'https://bugs.python.org/ChristianPrez'

    bugs.python.org fields:

    activity = <Date 2014-01-22.13:10:17.829>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-01-22.13:07:00.819>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2014-01-22.11:05:09.495>
    creator = 'Christian.P\xc3\xa9rez'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 20343
    keywords = []
    message_count = 4.0
    messages = ['208779', '208781', '208791', '208800']
    nosy_count = 2.0
    nosy_names = ['serhiy.storchaka', 'Christian.P\xc3\xa9rez']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = 'resolved'
    status = 'closed'
    superseder = '20048'
    type = 'behavior'
    url = 'https://bugs.python.org/issue20343'
    versions = ['Python 2.7']

    Activity

    1. ChristianPrez commented on Jan 22, 2014

      ChristianPrezmannequin
      MannequinAuthor

      To reproduce the error:

      $ wget http://dbnsfp.houstonbioinformatics.org/dbNSFPzip/dbNSFP2.0.zip
      $ python
      Python 2.7.4 (default, Sep 26 2013, 03:20:26) 
      [GCC 4.7.3] on linux2
      Type "help", "copyright", "credits" or "license" for more information.
      >>> from zipfile import ZipFile
      >>> 
      >>> with ZipFile("dbNSFP2.0.zip", "r") as zf:
      ...   with zf.open("dbNSFP2.0_variant.chr20", "U") as f:
      ...     count = 0
      ...     for line in f:
      ...       count += 1
      ... 
      
      >>> print count
      964352
      $ unzip -p dbNSFP2.0.zip dbNSFP2.0_variant.chr20 | wc -l
      2161277

      may it be related to bpo-6759 ?

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or error
      on Jan 22, 2014
    3. serhiy-storchaka commented on Jan 22, 2014

      @serhiy-storchaka
      Member

      Could you please test with in-development version Python 2.7.6+? Unlikely it is related to bpo-6759, but perhaps it is related to bpo-20048.

    4. ChristianPrez commented on Jan 22, 2014

      ChristianPrezmannequin
      MannequinAuthor

      With 2.7.6+ works fine.

      Python 2.7.6+ (2.7:c28e07377b03, Jan 22 2014, 12:56:14) 
      [GCC 4.7.3] on linux2
      Type "help", "copyright", "credits" or "license" for more information.
      >>> from zipfile import ZipFile
      [54979 refs]
      >>> 
      [54979 refs]
      >>> with ZipFile("dbNSFP2.0.zip", "r") as zf:
      ...     with zf.open("dbNSFP2.0_variant.chr20", "U") as f:
      ...             count = 0
      ...             for line in f:
      ...                     count += 1
      ... 
      [55930 refs]
      >>> print count
      2161277
      [55930 refs]

      I tested it with Python 3.3 and works fine too.

    5. serhiy-storchaka commented on Jan 22, 2014

      @serhiy-storchaka
      Member

      Thank you for your report Christian. This bug already fixed in bpo-20048. Wait for Python 2.7.7 bugfix release.

    6. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions