Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-evaluate symlink handling #28

Closed
SUPERCILEX opened this issue Nov 23, 2023 · 1 comment
Closed

Re-evaluate symlink handling #28

SUPERCILEX opened this issue Nov 23, 2023 · 1 comment

Comments

@SUPERCILEX
Copy link
Owner

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.

@SUPERCILEX
Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant