Tarek Ziadé <ziade.ta...@gmail.com> added the comment:

The whole error handling in rmtree strikes me as something that cannot be used 
efficiently. (see also #7969).

How can you decide in an isolated function, that can be called anywhere in the 
tree you want to remove, the proper thing to do ? You don't know the global 
status of what is going on. 

I think rmtree() should drop these onerror calls and have two different 
behaviors:

1/ remove all it can in the tree, and return a list of files it couldn't 
remove, with the error for each file. The developer can then act upon.

2/ analyze the tree to see if the full removal can be done. If it's possible, 
it does it, if not, it doesn't do anything and return the problems.


For 2/ a possible way to do it could be to copy in a temporary place files that 
are being removed and copy them back in place in case a problem occurs. This 
can be long and space consuming though, for big files and big trees. I am not 
100% sure 2/ is really useful though...

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8523>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to