[issue1439312] Patch for bug 1438185: os.renames deletes junction points

Martin v. Löwis report at bugs.python.org
Sun Jan 6 19:41:47 CET 2008


Martin v. Löwis added the comment:

I'm skeptical. If you consider junction points similar to symlinks on
POSIX, then it would be semantically correct to leave the junction point
in place, independent of whether their target directory is empty or not
- on Unix, rmdir fails if the target is a symlink.

Given the documentation, I think the removedirs function does exactly do
what the documentation specifies as the algorithm (i.e. recursively
rmdir until an error occurs). The promise ("remove all empty
intermediate directories") is not held: on POSIX, it would stop at a
symlink even if that symlink was the only entry in the directory, and on
Windows, the junction point is removed even if the target directory is
not empty. I would rather fix this in the documentation than change
something in the implementation.

If the behavior is to be changed, the documentation needs to be updated.
The patch does introduce a significant behavior change: if the last
directory is not empty, it now silently returns; previously, it would
raise OSError.

_____________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1439312>
_____________________________________


More information about the Python-bugs-list mailing list