GNU bug report logs - #54636
dired fails to update subdirs when files are created/deleted/renamed

Previous Next

Package: emacs;

Reported by: Andreas Schwab <schwab <at> linux-m68k.org>

Date: Wed, 30 Mar 2022 11:16:02 UTC

Severity: normal

Merged with 51486

Found in version 28.0.60

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54636 in the body.
You can then email your comments to 54636 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Wed, 30 Mar 2022 11:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Schwab <schwab <at> linux-m68k.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 30 Mar 2022 11:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: bug-gnu-emacs <at> gnu.org
Subject: dired fails to update subdirs when files are created/deleted/renamed
Date: Wed, 30 Mar 2022 13:15:11 +0200
dired-to-delete, dired-do-rename, dired-do-copy or
dired-create-directory fail to update the dired buffer when performed in
a subdirectory.

This is a regression from Emacs 27.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Wed, 30 Mar 2022 12:04:02 GMT) Full text and rfc822 format available.

Message #8 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 54636 <at> debbugs.gnu.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Wed, 30 Mar 2022 15:03:06 +0300
> Resent-From: Andreas Schwab <schwab <at> linux-m68k.org>
> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
> Resent-CC: bug-gnu-emacs <at> gnu.org
> Resent-Sender: help-debbugs <at> gnu.org
> From: Andreas Schwab <schwab <at> linux-m68k.org>
> Date: Wed, 30 Mar 2022 13:15:11 +0200
> 
> dired-to-delete, dired-do-rename, dired-do-copy or
> dired-create-directory fail to update the dired buffer when performed in
> a subdirectory.
> 
> This is a regression from Emacs 27.

Thanks.  A bisection will be appreciated.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Wed, 30 Mar 2022 12:12:02 GMT) Full text and rfc822 format available.

Message #11 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: 54636 <at> debbugs.gnu.org
Cc: Tassilo Horn <tsdh <at> gnu.org>
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Wed, 30 Mar 2022 14:11:23 +0200
Broken by 7b50ed553f Ask if dir and subdir dired buffers be killed when
deleting dir.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Wed, 30 Mar 2022 12:46:01 GMT) Full text and rfc822 format available.

Message #14 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 54636 <at> debbugs.gnu.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Wed, 30 Mar 2022 14:43:22 +0200
Andreas Schwab <schwab <at> linux-m68k.org> writes:

> Broken by 7b50ed553f Ask if dir and subdir dired buffers be killed
> when deleting dir.

Oh, sorry, I'll look into it ASAP.  I guess this is to be corrected in
emacs-28?

Bye,
Tassilo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Wed, 30 Mar 2022 13:23:01 GMT) Full text and rfc822 format available.

Message #17 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: 54636 <at> debbugs.gnu.org, schwab <at> linux-m68k.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Wed, 30 Mar 2022 16:22:43 +0300
> From: Tassilo Horn <tsdh <at> gnu.org>
> Cc: 54636 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
> Date: Wed, 30 Mar 2022 14:43:22 +0200
> 
> Andreas Schwab <schwab <at> linux-m68k.org> writes:
> 
> > Broken by 7b50ed553f Ask if dir and subdir dired buffers be killed
> > when deleting dir.

Thanks for the bisection, Andreas, it made finding the culprit very
easy.

> Oh, sorry, I'll look into it ASAP.  I guess this is to be corrected in
> emacs-28?

Yes.

I think I just fixed it there, please take a look.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Wed, 30 Mar 2022 13:44:01 GMT) Full text and rfc822 format available.

Message #20 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 54636 <at> debbugs.gnu.org, schwab <at> linux-m68k.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Wed, 30 Mar 2022 15:29:36 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Oh, sorry, I'll look into it ASAP.  I guess this is to be corrected
>> in emacs-28?
>
> Yes.
>
> I think I just fixed it there, please take a look.

That's what I was about to do, too, but that's not right, too.  Say you
have dired buffers for

  ~/
  ~/foo/
  ~/foo/bar/

and then delete ~/foo from inside the ~/ dired buffer.  You'll be asked
if the buffers for foo should be delete, too, and when you confirm, what
is deleted are the buffers ~/ and ~/foo but ~/foo/bar persists.  So the
buffers are deleted downwards (to the root) instead of upwards which is
wrong.

I guess I recognized that in 7b50ed553f and switched the arguments for
that very reason.  (file-in-directory-p has the same argument order as
dired-in-this-tree.)

Bye,
Tassilo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Wed, 30 Mar 2022 13:57:01 GMT) Full text and rfc822 format available.

Message #23 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: 54636 <at> debbugs.gnu.org, schwab <at> linux-m68k.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Wed, 30 Mar 2022 16:56:38 +0300
> From: Tassilo Horn <tsdh <at> gnu.org>
> Cc: schwab <at> linux-m68k.org, 54636 <at> debbugs.gnu.org
> Date: Wed, 30 Mar 2022 15:29:36 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> Oh, sorry, I'll look into it ASAP.  I guess this is to be corrected
> >> in emacs-28?
> >
> > Yes.
> >
> > I think I just fixed it there, please take a look.
> 
> That's what I was about to do, too, but that's not right, too.

Well, it fixes the regression.

> Say you have dired buffers for
> 
>   ~/
>   ~/foo/
>   ~/foo/bar/
> 
> and then delete ~/foo from inside the ~/ dired buffer.  You'll be asked
> if the buffers for foo should be delete, too, and when you confirm, what
> is deleted are the buffers ~/ and ~/foo but ~/foo/bar persists.  So the
> buffers are deleted downwards (to the root) instead of upwards which is
> wrong.

This means your fix for the "ask" part is incomplete, and should be
improved.  But that is a new feature in Emacs 28, so it is not a
catastrophe if it is imperfect.  Regressions in previously correct
behavior are much worse.

Of course, if you can come up with a fix for the question-asking part
that makes it delete all the relevant buffers, and if that fix is safe
enough (a high bar at this late stage of the pretest), we can install
that on the release branch.  Failing that, the fix for that will have
to wait till Emacs 28.2 at the very least.

> I guess I recognized that in 7b50ed553f and switched the arguments for
> that very reason.  (file-in-directory-p has the same argument order as
> dired-in-this-tree.)

But reversing the arguments breaks dired-in-this-tree completely,
because it doesn't treat the arguments symmetrically.  In the scenario
described by Andreas, dired-in-this-tree consistently returned nil for
a subdirectory inserted into a Dired buffer of its parent with 'i'.
Specifically, DIR will _never_ match DIR/FILE inside
dired-in-this-tree, only the other way around.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Wed, 30 Mar 2022 14:42:01 GMT) Full text and rfc822 format available.

Message #26 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 54636 <at> debbugs.gnu.org, schwab <at> linux-m68k.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Wed, 30 Mar 2022 16:30:22 +0200
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

Hi Eli,

>> > I think I just fixed it there, please take a look.
>> 
>> That's what I was about to do, too, but that's not right, too.
>
> Well, it fixes the regression.

That's true.

>> Say you have dired buffers for
>> 
>>   ~/
>>   ~/foo/
>>   ~/foo/bar/
>> 
>> and then delete ~/foo from inside the ~/ dired buffer.  You'll be
>> asked if the buffers for foo should be delete, too, and when you
>> confirm, what is deleted are the buffers ~/ and ~/foo but ~/foo/bar
>> persists.  So the buffers are deleted downwards (to the root) instead
>> of upwards which is wrong.
>
> This means your fix for the "ask" part is incomplete, and should be
> improved.  But that is a new feature in Emacs 28, so it is not a
> catastrophe if it is imperfect.

It's still a major annoyance since the feature is not opt-in.

> Regressions in previously correct behavior are much worse.

Of course.

> Of course, if you can come up with a fix for the question-asking part
> that makes it delete all the relevant buffers, and if that fix is safe
> enough (a high bar at this late stage of the pretest), we can install
> that on the release branch.  Failing that, the fix for that will have
> to wait till Emacs 28.2 at the very least.

Here's a patch.  I've created a separate cond-arm for the SUBDIRS case,
so any callers which are not dired-clean-up-after-deletion (the only one
setting SUBDIRS) are not affected.

[dired.patch (text/x-patch, inline)]
diff --git a/lisp/dired.el b/lisp/dired.el
index 75dcd33e67..972a0865f4 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2874,8 +2874,9 @@ dired-buffers-for-dir
   "Return a list of buffers for DIR (top level or in-situ subdir).
 If FILE is non-nil, include only those whose wildcard pattern (if any)
 matches FILE.
-If SUBDIRS is non-nil, also include the dired buffers of
-directories below DIR.
+If SUBDIRS is non-nil, include the dired buffers of DIR and the
+directories below DIR instead (but no dired buffers with in-situ
+subdir DIR).
 The list is in reverse order of buffer creation, most recent last.
 As a side effect, killed dired buffers for DIR are removed from
 `dired-buffers'."
@@ -2887,10 +2888,9 @@ dired-buffers-for-dir
        ((null (buffer-name buf))
 	;; Buffer is killed - clean up:
 	(setq dired-buffers (delq elt dired-buffers)))
-       ((dired-in-this-tree-p dir (car elt))
+       ((and (null subdirs) (dired-in-this-tree-p dir (car elt)))
 	(with-current-buffer buf
-          (when (and (or subdirs
-                         (assoc dir dired-subdir-alist))
+          (when (and (assoc dir dired-subdir-alist)
 	             (or (null file)
 		         (if (stringp dired-directory)
 		             (let ((wildcards (file-name-nondirectory
@@ -2900,7 +2900,9 @@ dired-buffers-for-dir
                                                    file)))
 		           (member (expand-file-name file dir)
 			           (cdr dired-directory)))))
-            (setq result (cons buf result)))))))
+            (setq result (cons buf result)))))
+       ((and subdirs (dired-in-this-tree-p (car elt) dir))
+        (setq result (cons buf result)))))
     result))
 
 (defun dired-glob-regexp (pattern)
[Message part 3 (text/plain, inline)]
Can we agree it is safe enough?

Bye,
Tassilo

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Wed, 30 Mar 2022 15:52:02 GMT) Full text and rfc822 format available.

Message #29 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: 54636 <at> debbugs.gnu.org, schwab <at> linux-m68k.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Wed, 30 Mar 2022 18:51:56 +0300
> From: Tassilo Horn <tsdh <at> gnu.org>
> Cc: schwab <at> linux-m68k.org, 54636 <at> debbugs.gnu.org
> Date: Wed, 30 Mar 2022 16:30:22 +0200
> 
> Here's a patch.  I've created a separate cond-arm for the SUBDIRS case,
> so any callers which are not dired-clean-up-after-deletion (the only one
> setting SUBDIRS) are not affected.

Thanks.

So when will SUBDIRS be non-nil?  dired-clean-up-after-deletion is
called not only when a directory is deleted, I think.

Andreas, could you perhaps also try this patch and see if you have any
problems in your use cases?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Wed, 30 Mar 2022 16:13:02 GMT) Full text and rfc822 format available.

Message #32 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 54636 <at> debbugs.gnu.org, schwab <at> linux-m68k.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Wed, 30 Mar 2022 18:02:15 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Tassilo Horn <tsdh <at> gnu.org>
>> Cc: schwab <at> linux-m68k.org, 54636 <at> debbugs.gnu.org
>> Date: Wed, 30 Mar 2022 16:30:22 +0200
>> 
>> Here's a patch.  I've created a separate cond-arm for the SUBDIRS case,
>> so any callers which are not dired-clean-up-after-deletion (the only one
>> setting SUBDIRS) are not affected.
>
> Thanks.
>
> So when will SUBDIRS be non-nil?  dired-clean-up-after-deletion is
> called not only when a directory is deleted, I think.

Yes, it's also called when deleting a file but in that case
dired-buffers-for-dir will return nil, so no buffer will be deleted.
Probably, I shouldn't even bother to call it if a file has been deleted.

I think my patch is valid but now I think I should just create a
separate function dired-buffers-for-cleanup and use that from
dired-clean-up-after-deletion (or just collect the buffers in that
function) and remove the SUBDIRS argument from dired-buffers-for-dir as
it changes its logic too drastically.

I'll prepare a patch in that direction later.

Bye,
Tassilo




Forcibly Merged 51486 54636. Request was from Filipp Gunbin <fgunbin <at> fastmail.fm> to control <at> debbugs.gnu.org. (Wed, 30 Mar 2022 16:27:01 GMT) Full text and rfc822 format available.

Disconnected #54636 from all other report(s). Request was from Filipp Gunbin <fgunbin <at> fastmail.fm> to control <at> debbugs.gnu.org. (Wed, 30 Mar 2022 16:28:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Wed, 30 Mar 2022 16:31:02 GMT) Full text and rfc822 format available.

Message #39 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: 54636 <at> debbugs.gnu.org, schwab <at> linux-m68k.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Wed, 30 Mar 2022 19:30:20 +0300
> From: Tassilo Horn <tsdh <at> gnu.org>
> Cc: schwab <at> linux-m68k.org, 54636 <at> debbugs.gnu.org
> Date: Wed, 30 Mar 2022 18:02:15 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > So when will SUBDIRS be non-nil?  dired-clean-up-after-deletion is
> > called not only when a directory is deleted, I think.
> 
> Yes, it's also called when deleting a file but in that case
> dired-buffers-for-dir will return nil, so no buffer will be deleted.

What about moving/renaming a directory?

> I think my patch is valid but now I think I should just create a
> separate function dired-buffers-for-cleanup and use that from
> dired-clean-up-after-deletion (or just collect the buffers in that
> function) and remove the SUBDIRS argument from dired-buffers-for-dir as
> it changes its logic too drastically.
> 
> I'll prepare a patch in that direction later.

At this point, I'd prefer the safest, simplest patch for the release
branch, because I intend to release Emacs 28.1 VSN.  We can make a
cleaner fix on master later.

Do you think this patch you posted is safe enough for Emacs 28.1?




Merged 51486 54636. Request was from Filipp Gunbin <fgunbin <at> fastmail.fm> to control <at> debbugs.gnu.org. (Wed, 30 Mar 2022 16:31:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Wed, 30 Mar 2022 16:32:01 GMT) Full text and rfc822 format available.

Message #44 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 54636 <at> debbugs.gnu.org, schwab <at> linux-m68k.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Wed, 30 Mar 2022 18:29:29 +0200
[Message part 1 (text/plain, inline)]
Tassilo Horn <tsdh <at> gnu.org> writes:

> I think my patch is valid but now I think I should just create a
> separate function dired-buffers-for-cleanup and use that from
> dired-clean-up-after-deletion (or just collect the buffers in that
> function) and remove the SUBDIRS argument from dired-buffers-for-dir
> as it changes its logic too drastically.
>
> I'll prepare a patch in that direction later.

Here it is:

[dired2.patch (text/x-patch, inline)]
diff --git a/lisp/dired.el b/lisp/dired.el
index 75dcd33e67..89b81ca0db 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2870,12 +2870,10 @@ dired-copy-filename-as-kill
 
 ;;; Keeping Dired buffers in sync with the filesystem and with each other
 
-(defun dired-buffers-for-dir (dir &optional file subdirs)
+(defun dired-buffers-for-dir (dir &optional file)
   "Return a list of buffers for DIR (top level or in-situ subdir).
 If FILE is non-nil, include only those whose wildcard pattern (if any)
 matches FILE.
-If SUBDIRS is non-nil, also include the dired buffers of
-directories below DIR.
 The list is in reverse order of buffer creation, most recent last.
 As a side effect, killed dired buffers for DIR are removed from
 `dired-buffers'."
@@ -2889,8 +2887,7 @@ dired-buffers-for-dir
 	(setq dired-buffers (delq elt dired-buffers)))
        ((dired-in-this-tree-p dir (car elt))
 	(with-current-buffer buf
-          (when (and (or subdirs
-                         (assoc dir dired-subdir-alist))
+          (when (and (assoc dir dired-subdir-alist)
 	             (or (null file)
 		         (if (stringp dired-directory)
 		             (let ((wildcards (file-name-nondirectory
@@ -2903,6 +2900,22 @@ dired-buffers-for-dir
             (setq result (cons buf result)))))))
     result))
 
+(defun dired-buffers-for-dir-or-subdir (dir)
+  "Return a list of buffers for DIR or a subdirectory thereof.
+As a side effect, killed dired buffers for DIR are removed from
+`dired-buffers'."
+  (setq dir (file-name-as-directory dir))
+  (let (result buf)
+    (dolist (elt dired-buffers)
+      (setq buf (cdr elt))
+      (cond
+       ((null (buffer-name buf))
+	;; Buffer is killed - clean up:
+	(setq dired-buffers (delq elt dired-buffers)))
+       ((dired-in-this-tree-p (car elt) dir)
+        (setq result (cons buf result)))))
+    result))
+
 (defun dired-glob-regexp (pattern)
   "Convert glob-pattern PATTERN to a regular expression."
   (let ((matched-in-pattern 0)  ;; How many chars of PATTERN we've handled.
@@ -3479,15 +3492,16 @@ dired-clean-up-after-deletion
                                      (file-name-nondirectory fn))))
                (not dired-clean-confirm-killing-deleted-buffers))
            (kill-buffer buf)))
-    (let ((buf-list (dired-buffers-for-dir (expand-file-name fn)
-                                           nil 'subdirs)))
+    (let ((buf-list (dired-buffers-for-dir-or-subdir
+                     (expand-file-name fn))))
       (and buf-list
            (or (and dired-clean-confirm-killing-deleted-buffers
                     (y-or-n-p
                      (format
-                      (ngettext "Kill Dired buffer of %s, too? "
-                                "Kill Dired buffers of %s, too? "
-                                (length buf-list))
+                      (ngettext
+                       "Kill Dired buffer of %s, too? "
+                       "Kill Dired buffers of %s and its sub-directories, too? "
+                       (length buf-list))
                       (file-name-nondirectory
                        ;; FN may end in a / if `dired-listing-switches'
                        ;; contains -p, so we need to strip that
[Message part 3 (text/plain, inline)]
I think that's a better approach than changing dired-buffers-for-dir
which I shouldn't have done in the first place.

Bye,
Tassilo

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Wed, 30 Mar 2022 16:38:01 GMT) Full text and rfc822 format available.

Message #47 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 54636 <at> debbugs.gnu.org, schwab <at> linux-m68k.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Wed, 30 Mar 2022 18:32:41 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Tassilo Horn <tsdh <at> gnu.org>
>> Cc: schwab <at> linux-m68k.org, 54636 <at> debbugs.gnu.org
>> Date: Wed, 30 Mar 2022 18:02:15 +0200
>> 
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>> 
>> > So when will SUBDIRS be non-nil?  dired-clean-up-after-deletion is
>> > called not only when a directory is deleted, I think.
>> 
>> Yes, it's also called when deleting a file but in that case
>> dired-buffers-for-dir will return nil, so no buffer will be deleted.
>
> What about moving/renaming a directory?

No, it's only called from dired-delete-entry which is only called from
dired-internal-do-deletions which is only called from dired-do-delete
and dired-do-flagged-delete.  So only real deletions.

>> I think my patch is valid but now I think I should just create a
>> separate function dired-buffers-for-cleanup and use that from
>> dired-clean-up-after-deletion (or just collect the buffers in that
>> function) and remove the SUBDIRS argument from dired-buffers-for-dir as
>> it changes its logic too drastically.
>> 
>> I'll prepare a patch in that direction later.
>
> At this point, I'd prefer the safest, simplest patch for the release
> branch, because I intend to release Emacs 28.1 VSN.  We can make a
> cleaner fix on master later.

The other patch with the separate function only called by
dired-clean-up-after-deletion is equivalent and safer than the
modification of dired-buffers-for-dir which is called in many places.
In the worst case, we have a cleanup problem after directory deletion.

> Do you think this patch you posted is safe enough for Emacs 28.1?

Yes, but I'd very much prefer to use the newer patch from my mail some
minutes ago for the reasons explained above.

Bye,
Tassilo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Wed, 30 Mar 2022 16:43:02 GMT) Full text and rfc822 format available.

Message #50 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: 54636 <at> debbugs.gnu.org, schwab <at> linux-m68k.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Wed, 30 Mar 2022 19:42:50 +0300
> From: Tassilo Horn <tsdh <at> gnu.org>
> Cc: schwab <at> linux-m68k.org, 54636 <at> debbugs.gnu.org
> Date: Wed, 30 Mar 2022 18:29:29 +0200
> 
> > I'll prepare a patch in that direction later.
> 
> Here it is:
> [...]
> I think that's a better approach than changing dired-buffers-for-dir
> which I shouldn't have done in the first place.

If so, can we restore dired-buffers-for-dir to what it was in Emacs
27?  AFAICT, the only difference now is that you use 'when' instead of
just 'and' -- is there a reason for that?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Wed, 30 Mar 2022 16:49:01 GMT) Full text and rfc822 format available.

Message #53 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 54636 <at> debbugs.gnu.org, schwab <at> linux-m68k.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Wed, 30 Mar 2022 18:47:49 +0200 (GMT+02:00)
30.03.2022 18:42:48 Eli Zaretskii <eliz <at> gnu.org>:

>> From: Tassilo Horn <tsdh <at> gnu.org>
>> Cc: schwab <at> linux-m68k.org, 54636 <at> debbugs.gnu.org
>> Date: Wed, 30 Mar 2022 18:29:29 +0200
>>
>>> I'll prepare a patch in that direction later.
>>
>> Here it is:
>> [...]
>> I think that's a better approach than changing dired-buffers-for-dir
>> which I shouldn't have done in the first place.
>
> If so, can we restore dired-buffers-for-dir to what it was in Emacs
> 27?  AFAICT, the only difference now is that you use 'when' instead of
> just 'and' -- is there a reason for that?

No reason except stylistic preference.
I can change that if you want.

Bye,
Tassilo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Wed, 30 Mar 2022 16:56:02 GMT) Full text and rfc822 format available.

Message #56 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: 54636 <at> debbugs.gnu.org, schwab <at> linux-m68k.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Wed, 30 Mar 2022 19:55:18 +0300
> Date: Wed, 30 Mar 2022 18:47:49 +0200 (GMT+02:00)
> From: Tassilo Horn <tsdh <at> gnu.org>
> Cc: schwab <at> linux-m68k.org, 54636 <at> debbugs.gnu.org
> 
> 
> 30.03.2022 18:42:48 Eli Zaretskii <eliz <at> gnu.org>:
> 
> >> From: Tassilo Horn <tsdh <at> gnu.org>
> >> Cc: schwab <at> linux-m68k.org, 54636 <at> debbugs.gnu.org
> >> Date: Wed, 30 Mar 2022 18:29:29 +0200
> >>
> >>> I'll prepare a patch in that direction later.
> >>
> >> Here it is:
> >> [...]
> >> I think that's a better approach than changing dired-buffers-for-dir
> >> which I shouldn't have done in the first place.
> >
> > If so, can we restore dired-buffers-for-dir to what it was in Emacs
> > 27?  AFAICT, the only difference now is that you use 'when' instead of
> > just 'and' -- is there a reason for that?
> 
> No reason except stylistic preference.
> I can change that if you want.

Yes, please.  And then please install on the emacs-28 branch.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Tue, 05 Apr 2022 06:35:01 GMT) Full text and rfc822 format available.

Message #59 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 54636 <at> debbugs.gnu.org, schwab <at> linux-m68k.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Wed, 30 Mar 2022 19:51:48 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

Hi all,

sorry, this message has sit in my drafts folder since March, 30th but
apparently wasn't sent.  The fix was committed to emacs-28 on that day.

>> > If so, can we restore dired-buffers-for-dir to what it was in Emacs
>> > 27?  AFAICT, the only difference now is that you use 'when' instead
>> > of just 'and' -- is there a reason for that?
>> 
>> No reason except stylistic preference.
>> I can change that if you want.
>
> Yes, please.  And then please install on the emacs-28 branch.

Done, thank you.

Andreas, could you please test if the bug it fixed for you (not that I
did't try myself) and close the report if it is?

Bye,
Tassilo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Tue, 05 Apr 2022 11:31:02 GMT) Full text and rfc822 format available.

Message #62 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: 54636 <at> debbugs.gnu.org, schwab <at> linux-m68k.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Tue, 05 Apr 2022 14:30:46 +0300
> From: Tassilo Horn <tsdh <at> gnu.org>
> Cc: schwab <at> linux-m68k.org, 54636 <at> debbugs.gnu.org
> Date: Wed, 30 Mar 2022 19:51:48 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> Hi all,
> 
> sorry, this message has sit in my drafts folder since March, 30th but
> apparently wasn't sent.  The fix was committed to emacs-28 on that day.

Yes, thanks.  (I wouldn't have released Emacs 28.1 if I wasn't aware
of your commit that day.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54636; Package emacs. (Sun, 09 Jul 2023 09:08:02 GMT) Full text and rfc822 format available.

Message #65 received at 54636 <at> debbugs.gnu.org (full text, mbox):

From: Jakub Ječmínek <jecminek.k <at> gmail.com>
To: 54636 <at> debbugs.gnu.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Sat, 8 Jul 2023 20:31:18 +0200
[Message part 1 (text/plain, inline)]
Hello,
I’m going through bug reports to see where I can help and it seems that is
particular issue has been resolved but never closed? Is there something
else waiting to be done?

Best, Kuba
[Message part 2 (text/html, inline)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sun, 09 Jul 2023 11:11:01 GMT) Full text and rfc822 format available.

Notification sent to Andreas Schwab <schwab <at> linux-m68k.org>:
bug acknowledged by developer. (Sun, 09 Jul 2023 11:11:01 GMT) Full text and rfc822 format available.

Message #70 received at 54636-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jakub Ječmínek <jecminek.k <at> gmail.com>
Cc: 54636-done <at> debbugs.gnu.org
Subject: Re: bug#54636: dired fails to update subdirs when files are
 created/deleted/renamed
Date: Sun, 09 Jul 2023 14:09:58 +0300
> From: Jakub Ječmínek <jecminek.k <at> gmail.com>
> Date: Sat, 8 Jul 2023 20:31:18 +0200
> 
> I’m going through bug reports to see where I can help and it seems that is particular issue has been
> resolved but never closed? Is there something else waiting to be done?

Nothing more to do; closing.

Thanks for the heads-up.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sun, 09 Jul 2023 11:11:02 GMT) Full text and rfc822 format available.

Notification sent to Filipp Gunbin <fgunbin <at> fastmail.fm>:
bug acknowledged by developer. (Sun, 09 Jul 2023 11:11:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 06 Aug 2023 11:24:06 GMT) Full text and rfc822 format available.

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

Previous Next


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