Ticket #3097 enhancement closed fixed
filepath.FilePath.remove breaks on symlinks
|Reported by:||cyli||Owned by:|
FilePath.remove on a symlink whose target is a directory will result in an OSError. FilePath.remove currently checks to see if the path is a directory, and if so, removes all children and then calls os.rmdir on itself. Otherwise, it calls os.remove on itself. The problem is that a link that points to a directory returns true for both islink() and isdir(). Therefore, when you call FilePath.remove on a symlink whose target is a directory, it will both empty that target directory (which probably is not a desirable outcome) and call rmdir on the link, which raises an error.