classification
Title: ZipInfo crashes on filemode
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: G.Rakosy, iritkatriel
Priority: normal Keywords:

Created on 2021-08-05 13:59 by G.Rakosy, last changed 2021-09-09 18:51 by iritkatriel.

Messages (2)
msg399006 - (view) Author: Gabor Rakosy (G.Rakosy) Date: 2021-08-05 13:59
"""
ZipInfo crashes on filemode

In file /usr/lib/python3.7/zipfile.py | class ZipInfo.__slots__
Does not contain keyword 'filemode'.
"""

import zipfile

file_zip = zipfile.ZipFile("test-one-dir.zip", mode='r')

res = []

info = file_zip.infolist()
print("info[0]", type(info[0]), info[0])

print("\n# ## Good")
for inf in info:
    print("\ninf", type(inf), inf)
    res.append((
        inf.filename,
##        inf.filemode,
        inf.compress_type,
        inf.compress_size,
        inf.file_size))

for fileinfo in res:
    print("\n", fileinfo)

print("\n# ## Bad")
for inf in info:
    print("\ninf", type(inf), inf)
    res.append((
        inf.filename,
        inf.filemode,
        inf.compress_type,
        inf.compress_size,
        inf.file_size))

for fileinfo in res:
    print("\n", fileinfo)
msg401511 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-09-09 18:51
Crash typically means segfault or the like, not an exception. 

Can you provide code to create the file "test-one-dir.zip" so that we can reproduce the issue?
History
Date User Action Args
2021-09-09 18:51:30iritkatrielsettype: crash -> behavior

messages: + msg401511
nosy: + iritkatriel
2021-08-05 13:59:45G.Rakosycreate