]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix trashing of symlink that points at a directory
authorMike Kupfer <mkupfer@alum.berkeley.edu>
Mon, 21 Nov 2022 00:44:20 +0000 (16:44 -0800)
committerEli Zaretskii <eliz@gnu.org>
Thu, 24 Nov 2022 11:17:08 +0000 (13:17 +0200)
* lisp/files.el (move-file-to-trash): Redefine is-directory so
that it is false for symlinks.

lisp/files.el

index 127cf77240f56f935f70468f6ebd926afd9cc33a..60c0eb917e55ac33292877e41143f96cfc973dd0 100644 (file)
@@ -8566,7 +8566,8 @@ Otherwise, trash FILENAME using the freedesktop.org conventions,
 
               ;; Make a .trashinfo file.  Use O_EXCL, as per trash-spec 1.0.
               (let* ((files-base (file-name-nondirectory fn))
-                      (is-directory (file-directory-p fn))
+                      (is-directory (and (file-directory-p fn)
+                                        (not (file-symlink-p fn))))
                       (overwrite nil)
                       info-fn)
                  ;; We're checking further down whether the info file