From e79f3c336e6d6c70421d25dd892c842f76516504 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 4 Nov 2022 17:34:41 -0700 Subject: FILE:SYMLINKED: delete existing links that point elsewhere Signed-off-by: Sean Whitton --- src/property/file.lisp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/property/file.lisp b/src/property/file.lisp index 2612805..e2435c7 100644 --- a/src/property/file.lisp +++ b/src/property/file.lisp @@ -249,8 +249,12 @@ directory, you can use one or more '../', or an absolute path." (failed-change "~A exists but is not a symbolic link." from)) (if (and link (string= (remote-link-target from) to)) :no-change - (progn - (containing-directory-exists from) (mrun "ln" "-sf" to from))))) + (progn (containing-directory-exists from) + ;; With at least GNU ln(1), passing -f, but not also -T, does + ;; not replace an existing link in some cases. + ;; -T is not POSIX, so we just remove any existing link first. + (does-not-exist from) + (mrun "ln" "-sf" to from))))) (:unapply (declare (ignore to)) (if (remote-test "-L" from) -- cgit v1.2.3