Issue 849218: ZipInfo shows incorrect file size for large files (original) (raw)
Issue849218
Created on 2003-11-25 20:09 by osuchw, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (3) | ||
---|---|---|
msg60430 - (view) | Author: Waldemar Osuch (osuchw) | Date: 2003-11-25 20:09 |
When dealing with large zipped files I've noticed that ZipInfo instance was reporting incorrect file size. I could reproduce the error by: txtfile = file('bigone.txt','w') for i in xrange(10**8): txtfile.write('%-9s Hello World\n'%i) txtfile.close() os.stat('bigone.txt').st_size 2300000000L Now I zip the bugger and: z = zipfile.ZipFile(file('bigone.zip','r')) fi = z.infolist()[0] fi.file_size -1994967296 After changing zipfile.py on line 26 from: structCentralDir = "<4s4B4H3l5HLl" to: structCentralDir = "<4s4B4H3L5HLl" I get: z = zipfile.ZipFile(file('bigone.zip','r')) fi = z.infolist()[0] fi.file_size 2300000000L Sorry for a digression but it would be nice to have something similar to a module from Twisted distribution (twisted.python.zipstream) in standard library. The above module allows to read a zipped file in chunks using iterator. It would help tremendously when dealing with large files. | ||
msg60431 - (view) | Author: A.M. Kuchling (akuchling) * ![]() |
Date: 2003-12-23 19:14 |
Logged In: YES user_id=11375 This isn't a sufficient fix; zipfile.py doesn't seem to handle files whose sizes don't fit into 32 bits. The ZIP specification at http://www.pkware. com/products/enterprise/white_papers/appnote.html#2 describes a zip64 format which can handle files larger than this limit; supporting it would require more extensive changes to zipfile.py. | ||
msg61333 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2008-01-20 19:07 |
Several 32bit related issues were solved a while ago. Please creaet a new issue if the latest (!) svn checkout fails for you. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:01 | admin | set | github: 39603 |
2008-01-20 19:07:07 | christian.heimes | set | status: open -> closedresolution: out of datemessages: + nosy: + christian.heimes |
2003-11-25 20:09:29 | osuchw | create |