Raghuram Devarakonda added the comment:
If rmtree() always returns in case of symbolic links (as it is
checked-in), wouldn't it be much simpler to totally do away with
'onerror' handling? I thought 'onerror' gives the user the option how to
proceed (which is true in other usages).
Georg Brandl added the comment:
Guido explicitly said it should raise IOError, not ValueError,
and it should use the onerror() handling used for all other errors
which makes sense for me too.
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1669
Raghuram Devarakonda added the comment:
and it should use the onerror() handling used for all other errors
which makes sense for me too.
Sure. I am ok with using 'onerror'. The point I am trying to make is
that there is slight difference between 'onerror' in this case and in
the three other
Changes by Tim Koopman:
--
title: shutils.rmtree fails on symlink, after deleting contents -
shutil.rmtree fails on symlink, after deleting contents
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1669
__
Raghuram Devarakonda added the comment:
Please try to include stack trace in bug reports. I reproduced the error
on my Linux (SuSE 10).
marvin:tmp$ ls -l dirlink testdir
lrwxrwxrwx 1 raghu users7 2007-12-20 10:10 dirlink - testdir/
testdir:
total 0
-rw-r--r-- 1 raghu users 0 2007-12-20
Guido van Rossum added the comment:
I agree with Tesiph, more useful behavior would be to raise an error
immediately because the argument is not a directory. If you wanted to
remove the think linked to, you could use rmtree(foo/.,
ignore_errors=True).
--
nosy: +gvanrossum
Raghuram Devarakonda added the comment:
I am ok with disallowing symlinks in rmtree() because if it were to be
allowed, the semantics are not clear. In addition, neither 'rmdir' nor
'rm -rf' delete the target directory.
The attached patch would raise error if symbolic link is passed to
rmtree.
Guido van Rossum added the comment:
Thanks for the patch. I think it should raise IOError, not ValueError,
and it should use the onerror() handling used for all other errors.
Also, can you include an update for the docs in the Doc tree?
__
Tracker [EMAIL
Raghuram Devarakonda added the comment:
Index: Lib/shutil.py
===
--- Lib/shutil.py (revision 59581)
+++ Lib/shutil.py (working copy)
@@ -156,6 +156,16 @@
elif onerror is None:
def onerror(*args):