Closed SUPERCILEX closed 10 months ago
Turns out this was expected because it's how linux makes sense of paths. For example, /my/path/
will resolve my
if it's a symlink and therefore behaves the same way if path
is a symlink. However, for deletion this isn't what you want: what does it even mean to delete the contents of a directory through a symlink? Do you delete the symlink at the end? The original directory? Both?
Anyway, the safer thing to do is to simply strip trailing slashes so we always delete the symlink. Note that I'm sure some LInux guru will eventually come along and tell me this behavior is wrong and you sometimes actually need the trailing slash for something. I'm going to wait until that happens before adding configuration options.
I just accidentally deleted the contents of a directory instead of its symlink which seems pretty stupid. Check the behavior of every scenario that involves symlinks and figure out what the behavior should be. I'm leaning towards never follow symlinks.