[ python-Bugs-1048941 ] os.rmtree error handling was always broken

SourceForge.net noreply at sourceforge.net
Mon Oct 18 08:06:52 CEST 2004


Bugs item #1048941, was opened at 2004-10-18 03:24
Message generated for change (Comment added) made by jlgijsbers
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1048941&group_id=5470

Category: None
Group: Python 2.3
Status: Open
Resolution: None
Priority: 8
Submitted By: Guido van Rossum (gvanrossum)
>Assigned to: Johannes Gijsbers (jlgijsbers)
Summary: os.rmtree error handling was always broken

Initial Comment:
I just realized that the error handling in
shutil.rmtree has been broken ever since Python 2.3,
and the new implementation in 2.4 inherits this bug.

The problem is that the try/except is outside the for
loop, so that when an error is found, if either
ignore_errors or onerror is set, the desired action is
taken *once* but then the function returns rather than
trying to remove more files (ignoring or reporting
subsequent errors) as it should.

The sad thing is that the original code by David Ascher
(shutil.py rev 1.8) was correct! The bug was introduced
in rev 1.27, which claimed to make the implementation
agree with the docs. :-(

I'm giving this a high priority, hoping that it will be
fixed in 2.4b2 (and hopefully backported to 2.3).

----------------------------------------------------------------------

>Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-10-18 08:06

Message:
Logged In: YES 
user_id=469548

Barry, hope you don't mind I'll take this one. I can have a
fix tonight or tomorrow.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1048941&group_id=5470


More information about the Python-bugs-list mailing list