[issue16735] zipfile.is_zipfile wrongly recognizes non-zip as zip
Serhiy Storchaka added the comment: zipinfo detects /usr/bin/zip as a zip archive too. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16735 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16735] zipfile.is_zipfile wrongly recognizes non-zip as zip
New submission from Bohuslav Slavek Kabrda: When I use zipfile.is_zipfile on file fastjar (sample uploaded at [1]) from libgcj, I get True, while I should get False (reproducible with fastjar from libgcj 4.7.2 on Fedora 18). This is caused by stringEndArchive string being present in the file, but the file still isn't zip. Would it be possible to add some further checks to eliminate this kind of errors? I'd like to submit a patch but I'm not sure what to check for, maybe some other constants mentioned in the ZIP format definition? Thanks a lot. [1] http://bkabrda.fedorapeople.org/fastjar -- components: Library (Lib) messages: 177804 nosy: bkabrda priority: normal severity: normal status: open title: zipfile.is_zipfile wrongly recognizes non-zip as zip versions: Python 2.7, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16735 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16735] zipfile.is_zipfile wrongly recognizes non-zip as zip
Serhiy Storchaka added the comment: You can upload a sample file on bug tracker. Actually jar files are just zip files (with some limitation and special files). zipfile.is_zipfile should return True on a jar file. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16735 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16735] zipfile.is_zipfile wrongly recognizes non-zip as zip
Bohuslav Slavek Kabrda added the comment: Oh, sorry, I will upload it on the bugtracker next time. I know that jar files are zip files, but this is not a jar (although it has jar in file). This is a binary. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16735 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16735] zipfile.is_zipfile wrongly recognizes non-zip as zip
R. David Murray added the comment: I'm imagining that it creates jar files, and thus has the signature as a constant. The is_zipfile check is much more complicated than just looking for that string, though, so what is going on must be even more perverse than that. It would be interesting to know if other zip tools have an issue with it, although be careful when comparing, since is_zipfile only does the initial check, whereas running another unzip tool against it may produce an error, but only later in the process (after the zip tool has decided it is a zip file and tries to process it). -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16735 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16735] zipfile.is_zipfile wrongly recognizes non-zip as zip
Serhiy Storchaka added the comment: $ zipinfo fastjar Archive: fastjar Zip file size: 47664 bytes, number of entries: 31883 [fastjar]: Zipfile is disk 33807 of a multi-disk archive, and this is not the disk on which the central zipfile directory begins (disk 190). I.e. zipinfo detects fastjar as a zip file, but fails to read a contents (`unzip -l fastjar` and `python -m zipinfo -l fastjar` fail too). The file contains an obviously incorrect values in the control structures. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16735 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16735] zipfile.is_zipfile wrongly recognizes non-zip as zip
R. David Murray added the comment: So, it looks like this is not a bug in Python, just a weirdness of fastjar. Or, if you prefer, a bug in fastjar (they could assemble the signature instead of coding it as a single constant). -- resolution: - invalid stage: - committed/rejected status: open - closed type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16735 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16735] zipfile.is_zipfile wrongly recognizes non-zip as zip
Serhiy Storchaka added the comment: It's rather a bug in the ZIP format design. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16735 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16735] zipfile.is_zipfile wrongly recognizes non-zip as zip
R. David Murray added the comment: Well, yes, but that ship has already sunk :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16735 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16735] zipfile.is_zipfile wrongly recognizes non-zip as zip
Bohuslav Slavek Kabrda added the comment: Tried is_zipfile on /usr/bin/zip and it returns True, too, so it seems that this is a more general problem for zip-handling binaries... Anyway, thank you both, I agree that there is not much that can be done here. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16735 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com