[issue22102] Zipfile generates Zipfile error in zip with 0 total number of disk in Zip64 end of central directory locator
New submission from Guillaume Carre: I've got a zip file with a Zip64 end of central directory locator in which: - total number of disks = - number of the disk with the start of the zip64 end of central directory = According to the test line 176 in zipfile.py this fails: if diskno != 0 or disks != 1: raise BadZipfile(zipfiles that span multiple disks are not supported) I believe the test should be changed to if diskno != 0 or disks 1: -- components: Library (Lib) messages: 224257 nosy: Guillaume.Carre priority: normal severity: normal status: open title: Zipfile generates Zipfile error in zip with 0 total number of disk in Zip64 end of central directory locator type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22102 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22102] Zipfile generates Zipfile error in zip with 0 total number of disk in Zip64 end of central directory locator
Guillaume Carre <gcarr...@gmail.com> added the comment: Yes these were pretty large zip 30 to 60Gb with thousands of small files in them I've fixed locally on our servers and we've been happy even after accepting similar sized files from linux machine. I'm also quite surprised about this not being reported by others. On Mon, Mar 12, 2018 at 9:01 AM, Thomas Kluyver <rep...@bugs.python.org> wrote: > > Thomas Kluyver <tho...@kluyver.me.uk> added the comment: > > If every Windows 7 computer is generating zipfiles which are invalid in > this way, that would be a pretty strong argument for Python (and other > tools) to accept it. But if that was the case, I would also expect that > there would be many more issues about it. > > Are the files you're compressing large (multi-GB)? Python only uses the > zip64 format when the files are too big for the older zip format; maybe > Windows is doing the same. Even in that case, I'm still surprised that more > people don't hit it. > > -- > > ___ > Python tracker <rep...@bugs.python.org> > <https://bugs.python.org/issue22102> > ___ > -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue22102> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22102] Zipfile generates Zipfile error in zip with 0 total number of disk in Zip64 end of central directory locator
Guillaume Carre <gcarr...@gmail.com> added the comment: Hi, In my case the zip file was created from windows 7 context menu (send to) Regards, Guillaume On Mon, Mar 12, 2018 at 5:08 AM, Thomas Kluyver <rep...@bugs.python.org> wrote: > > Thomas Kluyver <tho...@kluyver.me.uk> added the comment: > > I found source code for some other projects handling the same data. They > all seem to agree that it should be 1: > > - Golang's zip reading code: https://github.com/golang/go/blob/ > f7ac70a56604033e2b1abc921d3f0f6afc85a7b3/src/archive/zip/ > reader.go#L536-L538 > - A C contrib file with zlib: https://github.com/madler/zlib/blob/ > cacf7f1d4e3d44d871b605da3b647f07d718623f/contrib/minizip/zip.c#L620-L624 > - Code from Info-ZIP, which is used by many Linux distros, is a bit less > clear, but it has an illuminating comment: > > if ((G.ecrec.number_this_disk != 0x) && > (G.ecrec.number_this_disk != ecloc64_total_disks - 1)) { > /* Note: For some unknown reason, the developers at PKWARE decided to > store the "zip64 total disks" value as a counter starting from 1, > whereas all other "split/span volume" related fields use 0-based > volume numbers. Sigh... */ > > So I think you've got an invalid zip file. If it's otherwise valid, there > might be a case for Python tolerating that particular mistake. But it's > probably better to fix whatever is making the incorrect zip file, because > other tools are also going to reject it. > > -- > > ___ > Python tracker <rep...@bugs.python.org> > <https://bugs.python.org/issue22102> > ___ > -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue22102> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com