Skip to content

python fails to run zipapp when zip contains comments #71242

Closed

Description

@zaz600
mannequin
BPO 27055
Nosy @serhiy-storchaka, @zaz600
Superseder
  • bpo-5950: Make zipimport work with zipfile containing comments
  • Files
  • attach.zip: bad and good zips
  • 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 2016-05-19.05:53:05.809>
    created_at = <Date 2016-05-19.01:04:24.411>
    labels = ['type-crash']
    title = 'python fails to run zipapp when zip contains comments'
    updated_at = <Date 2016-05-19.05:53:05.792>
    user = 'https://github.com/zaz600'

    bugs.python.org fields:

    activity = <Date 2016-05-19.05:53:05.792>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-05-19.05:53:05.809>
    closer = 'serhiy.storchaka'
    components = []
    creation = <Date 2016-05-19.01:04:24.411>
    creator = 'zaz600'
    dependencies = []
    files = ['42894']
    hgrepos = []
    issue_num = 27055
    keywords = []
    message_count = 2.0
    messages = ['265839', '265848']
    nosy_count = 2.0
    nosy_names = ['serhiy.storchaka', 'zaz600']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '5950'
    type = 'crash'
    url = 'https://bugs.python.org/issue27055'
    versions = ['Python 3.5']

    Activity

    1. zaz600 commented on May 19, 2016

      zaz600mannequin
      MannequinAuthor

      python fails to run zipapp when zip contains comments
      when zip archive downloaded from github it contains tip hash in comment.

      Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win32

      example:

      import zipfile
      
      
      if __name__ == '__main__':
          with open('__main__.py', "w") as m:
            m.write("print('hello')")
          
      
          zipf = zipfile.ZipFile('zipapp_bad.zip', 'w', zipfile.ZIP_DEFLATED)
          #add zip comment
          zipf.comment=b"123321"
          zipf.write("__main__.py")
          zipf.close()
      
          zipf = zipfile.ZipFile('zipapp_good.zip', 'w', zipfile.ZIP_DEFLATED)
          zipf.write("__main__.py")
          zipf.close()
      

      D:\pywork\zip>python zipapp_good.zip
      hello

      D:\pywork\zip>python zipapp_bad.zip
      File "zipapp_bad.zip", line 1
      PK♥♦¶
      ^
      SyntaxError: invalid syntax

    2. added
      type-crashA hard crash of the interpreter, possibly with a core dump
      on May 19, 2016
    3. serhiy-storchaka commented on May 19, 2016

      @serhiy-storchaka
      Member

      This is a duplicate of bpo-5950.

    4. 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

      type-crashA hard crash of the interpreter, possibly with a core dump

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions