[issue40172] ZipInfo corrupts file names in some old zip archives
Yudi Levi added the comment: The main issue is that when extracting older zip files, files are actually written to disk with corrupted (altered) names. Unfortunately it's been a while since I saw this issue and I can't tell if it was fixed or if I simply can't reproduce it. I do see that encoding/decoding in ZipInfo is still inconsistent, sometimes uses ascii codepage and sometimes uses cp437 codepage which seems wrong to me. Not sure how we should handle it but I think that switching the default ascii encoding to cp437 to be consistent with the old implementation (and with the filename decoding) seems like the right way to go. -- ___ Python tracker <https://bugs.python.org/issue40172> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40105] Updating zip comment doesn't truncate the zip file
Change by Yudi : -- keywords: +patch pull_requests: +18698 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19333 ___ Python tracker <https://bugs.python.org/issue40105> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40172] ZipInfo corrupts file names in some old zip archives
Change by Yudi : -- keywords: +patch pull_requests: +18697 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19335 ___ Python tracker <https://bugs.python.org/issue40172> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40172] ZipInfo corrupts file names in some old zip archives
New submission from Yudi : Some old zip files that don't yet use unicode file names might have entries with characters beyond the ascii range. ZipInfo seems to encode these file names with 'cp437' codepage (correct for old zips) but decode them back with 'ascii' code page which might corrupt them. -- components: Library (Lib) files: example.zip messages: 365701 nosy: yudilevi priority: normal severity: normal status: open title: ZipInfo corrupts file names in some old zip archives type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file49030/example.zip ___ Python tracker <https://bugs.python.org/issue40172> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40105] Updating zip comment doesn't truncate the zip file
New submission from Yudi : Updating the zip file comment to a shorter comment should truncate the zip file at the end of the new comment. Instead, the new comment is written to the zip file but the file length stays the same. For example, for a zip file that has the following zip comment: b'This is my old amazing comment, I bet you really like it!' # 57 character long Executing the following code: zipFile = ZipFile(filePath, 'a') zipFile.comment = b'My new shorter comment' # 22 character long zipFile.close() Will actually update the comment length in the zip header to the correct new length (22), but the bytecode will still have the following data: b'My new shorter comment comment, I bet you really like it!' Python reads the comment correctly since it relies on the comment length from the metadata (as far as I can tell), but the file is corrupt. This is similar to the following old issue - https://bugs.python.org/issue9239 But I wasn't sure whether to try and re-open that old one or create a new one. Tested on version 3.8.2 (Windows 10). Thanks! -- components: Library (Lib) messages: 365278 nosy: yudilevi priority: normal severity: normal status: open title: Updating zip comment doesn't truncate the zip file type: behavior versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue40105> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com