From 650481a58ae1663aa44ecb805f70cafde469859a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 28 Sep 2023 11:23:59 +0200 Subject: [PATCH] ynh_safe_rm: Check if target is a symlink When calling ynh_safe_rm to a broken symlink, the function was erroring out. (test -e was following the symlink and returning false) We need to also check if it is a symlink before exiting. --- helpers/helpers.v2.1.d/utils | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers/helpers.v2.1.d/utils b/helpers/helpers.v2.1.d/utils index be57a6d73..0cbd7c004 100644 --- a/helpers/helpers.v2.1.d/utils +++ b/helpers/helpers.v2.1.d/utils @@ -168,7 +168,7 @@ ynh_safe_rm() { if [[ -z "$target" ]]; then ynh_print_warn "ynh_safe_rm called with empty argument, ignoring." - elif [[ ! -e $target ]]; then + elif [[ ! -e "$target" ]] && [[ ! -L "$target" ]]; then ynh_print_info "'$target' wasn't deleted because it doesn't exist." elif ! _acceptable_path_to_delete "$target"; then ynh_print_warn "Not deleting '$target' because it is not an acceptable path to delete."