GNU bug report logs - #68814
29.1; dired fails to mark links to . or .. for deletion

Previous Next

Package: emacs;

Reported by: Devon Sean McCullough <Emacs-hacker2023 <at> jovi.net>

Date: Tue, 30 Jan 2024 05:30:02 UTC

Severity: normal

Found in version 29.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Devon Sean McCullough <Emacs-hacker2023 <at> jovi.net>
Cc: 68814 <at> debbugs.gnu.org
Subject: bug#68814: 29.1; dired fails to mark links to . or .. for deletion
Date: Sat, 03 Feb 2024 12:40:34 +0200
> Date: Mon, 29 Jan 2024 21:36:04 -0600
> From: Devon Sean McCullough <Emacs-hacker2023 <at> jovi.net>
> 
> $ mkdir /tmp/scratch
> $ cd /tmp/scratch
> $ ln -s . self
> $ ln -s .. up
> $ ln -s ... ...
> $ emacs .
> Type the letter d three times.
> Dired fails to mark all three files for deletion, unlike prior versions.

Thanks.  This is the (unintended) result of fixing bug#38729.

How does the patch below look?  Do you see any possible problems with
it?  That is, would exempting symlinks from the dot-dot rule cause any
problems?

diff --git a/lisp/dired.el b/lisp/dired.el
index c33569d..d9fbafb 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -4110,6 +4110,11 @@ dired-mark
        (prefix-numeric-value arg)
        (lambda ()
          (when (or (not (looking-at-p dired-re-dot))
+                   ;; Don't skip symlinks to ".", "..", etc.
+                   (save-excursion
+                     (re-search-forward
+                      dired-permission-flags-regexp nil t)
+                     (eq (char-after (match-beginning 1)) ?l))
                    (not (equal dired-marker-char dired-del-marker)))
            (delete-char 1)
            (insert dired-marker-char))))))))




This bug report was last modified 1 year and 162 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.