all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#40974: 28.0.50; Prevent gnus registry from making entries when it shouldn't
@ 2020-04-30  1:31 Eric Abrahamsen
  2020-05-20 19:01 ` Eric Abrahamsen
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Abrahamsen @ 2020-04-30  1:31 UTC (permalink / raw)
  To: 40974

[-- Attachment #1: Type: text/plain, Size: 605 bytes --]

The function `gnus-registry-handle-action' is meant to handle message
entries when messages are being moved/copied/deleted. Code comments
indicate that if a message is being "moved to nowhere" it's actually
being deleted, but the code doesn't actually delete the entry. In fact,
because it unilaterally creates an entry before checking what to do with
it, but then never deletes it, it will *create* entries for messages
being deleted, or moved into groups that should be ignored.

The attached patch confirms that registry information about the message
should actually be kept, before keeping it.

Eric


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Prevent-gnus-registry-handle-action-from-creating-sp.patch --]
[-- Type: text/x-patch, Size: 2509 bytes --]

From 110fe2e7e0db383d9d1782863324069bece60fd4 Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <eric@ericabrahamsen.net>
Date: Wed, 29 Apr 2020 18:10:35 -0700
Subject: [PATCH] Prevent gnus-registry-handle-action from creating spurious
 entries

Thanks to Bob Newell for finding this.

* lisp/gnus/gnus-registry.el (gnus-registry-handle-action): If a
message entry ends up with no groups in its 'group key, that means the
entry should be deleted.
---
 lisp/gnus/gnus-registry.el | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el
index 480ed80ef8..f306889a7f 100644
--- a/lisp/gnus/gnus-registry.el
+++ b/lisp/gnus/gnus-registry.el
@@ -485,23 +485,25 @@ gnus-registry-handle-action
     (when from
       (setq entry (cons (delete from (assoc 'group entry))
                         (assq-delete-all 'group entry))))
-
-    (dolist (kv `((group ,to)
-                  (sender ,sender)
-                  (recipient ,@recipients)
-                  (subject ,subject)))
-      (when (cadr kv)
-        (let ((new (or (assq (car kv) entry)
-                       (list (car kv)))))
-          (dolist (toadd (cdr kv))
-            (unless (member toadd new)
-              (setq new (append new (list toadd)))))
-          (setq entry (cons new
-                            (assq-delete-all (car kv) entry))))))
-    (gnus-message 10 "Gnus registry: new entry for %s is %S"
-                  id
-                  entry)
-    (gnus-registry-insert db id entry)))
+    ;; Only keep the entry if the message is going to a new group, or
+    ;; it's still in some previous group.
+    (when (or to (alist-get 'group entry))
+      (dolist (kv `((group ,to)
+                    (sender ,sender)
+                    (recipient ,@recipients)
+                    (subject ,subject)))
+	(when (cadr kv)
+          (let ((new (or (assq (car kv) entry)
+			 (list (car kv)))))
+            (dolist (toadd (cdr kv))
+              (unless (member toadd new)
+		(setq new (append new (list toadd)))))
+            (setq entry (cons new
+                              (assq-delete-all (car kv) entry))))))
+      (gnus-message 10 "Gnus registry: new entry for %s is %S"
+                    id
+                    entry)
+      (gnus-registry-insert db id entry))))
 
 ;; Function for nn{mail|imap}-split-fancy: look up all references in
 ;; the cache and if a match is found, return that group.
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#40974: 28.0.50; Prevent gnus registry from making entries when it shouldn't
  2020-04-30  1:31 bug#40974: 28.0.50; Prevent gnus registry from making entries when it shouldn't Eric Abrahamsen
@ 2020-05-20 19:01 ` Eric Abrahamsen
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Abrahamsen @ 2020-05-20 19:01 UTC (permalink / raw)
  To: 40974

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> The function `gnus-registry-handle-action' is meant to handle message
> entries when messages are being moved/copied/deleted. Code comments
> indicate that if a message is being "moved to nowhere" it's actually
> being deleted, but the code doesn't actually delete the entry. In fact,
> because it unilaterally creates an entry before checking what to do with
> it, but then never deletes it, it will *create* entries for messages
> being deleted, or moved into groups that should be ignored.
>
> The attached patch confirms that registry information about the message
> should actually be kept, before keeping it.

Pushed to master.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-20 19:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30  1:31 bug#40974: 28.0.50; Prevent gnus registry from making entries when it shouldn't Eric Abrahamsen
2020-05-20 19:01 ` Eric Abrahamsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.