Ticket #3097 enhancement closed fixed
filepath.FilePath.remove breaks on symlinks
| Reported by: | cyli | Owned by: | |
|---|---|---|---|
| Priority: | highest | Milestone: | |
| Component: | core | Keywords: | |
| Cc: | therve | Branch: | branches/filepath-remove-symlink-3097 |
| Author: | Launchpad Bug: |
Description
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.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

