Skip to content
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

zipfile leaves a file handle open if file is zero size #51418

Closed
skelker mannequin opened this issue Oct 19, 2009 · 8 comments
Closed

zipfile leaves a file handle open if file is zero size #51418

skelker mannequin opened this issue Oct 19, 2009 · 8 comments
Labels
OS-windows type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@skelker
Copy link
Mannequin

skelker mannequin commented Oct 19, 2009

BPO 7169
Nosy @amauryfa, @bitdancer, @briancurtin
Files
  • zipfileCrash.py: The attached script replicates the issue for me.
  • 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:

    assignee = None
    closed_at = <Date 2009-10-26.12:43:52.495>
    created_at = <Date 2009-10-19.13:33:47.634>
    labels = ['OS-windows', 'type-crash']
    title = 'zipfile leaves a file handle open if file is zero size'
    updated_at = <Date 2009-10-28.19:19:36.655>
    user = 'https://bugs.python.org/skelker'

    bugs.python.org fields:

    activity = <Date 2009-10-28.19:19:36.655>
    actor = 'r.david.murray'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-10-26.12:43:52.495>
    closer = 'skelker'
    components = ['Windows']
    creation = <Date 2009-10-19.13:33:47.634>
    creator = 'skelker'
    dependencies = []
    files = ['15165']
    hgrepos = []
    issue_num = 7169
    keywords = []
    message_count = 8.0
    messages = ['94236', '94482', '94486', '94487', '94629', '94630', '94635', '94636']
    nosy_count = 5.0
    nosy_names = ['amaury.forgeotdarc', 'r.david.murray', 'brian.curtin', 'ryles', 'skelker']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue7169'
    versions = ['Python 2.6']

    @skelker
    Copy link
    Mannequin Author

    skelker mannequin commented Oct 19, 2009

    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.

    @skelker skelker mannequin added OS-windows type-crash A hard crash of the interpreter, possibly with a core dump labels Oct 19, 2009
    @ryles
    Copy link
    Mannequin

    ryles mannequin commented Oct 26, 2009

    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.

    @skelker
    Copy link
    Mannequin Author

    skelker mannequin commented Oct 26, 2009

    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)

    @skelker
    Copy link
    Mannequin Author

    skelker mannequin commented Oct 26, 2009

    Fixed in http://bugs.python.org/issue6511

    @skelker skelker mannequin closed this as completed Oct 26, 2009
    @briancurtin
    Copy link
    Member

    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?

    @skelker
    Copy link
    Mannequin Author

    skelker mannequin commented Oct 28, 2009

    That would be great. Perhaps that should be discussed in 6511. I'll make a note there.

    Steve Kelker
    (952)882-4381 (or x4381)

    @ryles
    Copy link
    Mannequin

    ryles mannequin commented Oct 28, 2009

    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.

    @bitdancer
    Copy link
    Member

    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.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    OS-windows type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants