Issue 7169: zipfile leaves a file handle open if file is zero size (original) (raw)

Created on 2009-10-19 13:33 by skelker, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
zipfileCrash.py skelker,2009-10-19 13:33 The attached script replicates the issue for me.
Messages (8)
msg94236 - (view) Author: (skelker) Date: 2009-10-19 13:33
I noticed today if I attempt to create a ZipFile object for read access, and the zip file is zero bytes, the ZipFile object throws an exception, but there is still an open handle to the file. So if I catch that exception, and then try to delete the file, the delete then fails. I have attached a script that replicates the issue.
msg94482 - (view) Author: Ryan Leslie (ryles) Date: 2009-10-26 09:18
I expect this should already be fixed by the commit in http://bugs.python.org/issue6511 BadZipFile will now be raised for empty files rather than IOError, and so ZipFile._GetContents() should now also close the file. The fix was committed to trunk, but I don't see it merged into 2.6.
msg94486 - (view) Author: (skelker) Date: 2009-10-26 12:42
Thanks. I did do a search before opening my ticket. Not sure why I didn't see that in my search. Sorry for the duplicate ticket. Steve Kelker (952)882-4381 (or x4381)
msg94487 - (view) Author: (skelker) Date: 2009-10-26 12:43
Fixed in http://bugs.python.org/issue6511
msg94629 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2009-10-28 14:19
Since the issue exists in 2.6 and is only currently fixed on trunk and beyond, shouldn't the 6511 fix make it's way backwards into 2.6.x?
msg94630 - (view) Author: (skelker) Date: 2009-10-28 14:37
That would be great. Perhaps that should be discussed in 6511. I'll make a note there. Steve Kelker (952)882-4381 (or x4381)
msg94635 - (view) Author: Ryan Leslie (ryles) Date: 2009-10-28 18:02
Yes, I think this fix should have been included in the 2.6 branch. I subscribed Amaury to look into that when I last updated.
msg94636 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-10-28 19:19
The 2.6 branch was frozen except for critical issues during the release process for 2.6.3 and then 2.6.4. Now that 2.6.4 is out, the bug fix can be backported.
History
Date User Action Args
2022-04-11 14:56:54 admin set github: 51418
2009-10-28 19:19:36 r.david.murray set nosy: + r.david.murraymessages: +
2009-10-28 18:02:24 ryles set messages: +
2009-10-28 14:37:03 skelker set messages: +
2009-10-28 14:19:35 brian.curtin set nosy: + brian.curtinmessages: +
2009-10-26 12:43:52 skelker set status: open -> closedmessages: +
2009-10-26 12:42:29 skelker set messages: +
2009-10-26 09🔞56 ryles set nosy: + amaury.forgeotdarc, rylesmessages: +
2009-10-19 13:33:47 skelker create