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

Add --follow_symlink to ynh_secure_remove #1716

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

Salamandar
Copy link
Contributor

The problem

yunohost/issues#2253

Solution

  • add --follow_symlink to ynh_secure_remove
  • Call readlink -f if --follow_symlink
  • test for file AND symlink existence.

PR Status

...

How to test

...

return
fi
if [[ "$follow_symlink" -eq 1 ]]; then
file=$(readlink -f "$file")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we don't remove the link?

@chri2
Copy link
Contributor

chri2 commented May 28, 2024

A symlink is just a file. My expectation (beside an additional --follow-symlinks) would be that the file is deleted no matter whether the symlink is broken or not, points to a socket, directory or whatever. I stumbled over this already...

I started using rm for symlinks: https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/52

@Salamandar
Copy link
Contributor Author

@chri2 Yes, I fully agree. The issue described here is not that.
The current issue is that if a symlink is broken, trying to remove it from the helper doesn't work.

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