-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Embedded zipfile fields dependent on absolute position #70481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Example: from zipfile import ZipFile
with open('a.zipp', 'wb') as base:
base.write(b'old\n')
with ZipFile(base, 'a') as myzip:
myzip.write('eggs.txt') If the embedded zip portion of the file is extracted (first four bytes deleted), some fields will be incorrect in the resultant file - commenting out line 3 produces a file that can serve as a comparison. These differences cause issues opening with some zip library implementations. My best guess is that this is related to this line: https://github.com/python/cpython/blob/master/Lib/zipfile.py#L1459 |
I'm not familiar with iOS development, but I'd hazard a guess that "some zip library implementations" means a (the official?) iOS zip library. |
Yes, this may be a bug. After appending all offsets are absolute file positions. Here is a patch that presumably fixes this issue. Unfortunately I can't write tests for this issue. ZipFile is too lenient and all written tests are passes with unpatched code. Please test the patch manually. |
spoo, can you confirm that the patch fixes your issue? |
On 06/03/2016 09:27 PM, Serhiy Storchaka wrote:
Yes, sorry, and thank you for looking into this! It may take me a few |
Thank you for looking into this! I don't have my tablet to test with at |
I confirmed this fixes the issue loading zips on an iPad. |
New changeset 005704f5634f by Serhiy Storchaka in branch '3.5': New changeset b06e75ae1981 by Serhiy Storchaka in branch '3.6': New changeset 64a19fe3a16a by Serhiy Storchaka in branch 'default': |
New changeset 9a99a88301ef by Serhiy Storchaka in branch '2.7': |
Thank you for your report and testing. |
Unfortunately we should revert this change. It breaks other cases. See bpo-29094. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: