From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#40974: 28.0.50; Prevent gnus registry from making entries when it shouldn't Date: Wed, 29 Apr 2020 18:31:19 -0700 Message-ID: <87r1w5hi8o.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="5527"; mail-complaints-to="usenet@ciao.gmane.io" To: 40974@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 30 03:57:10 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jTyRq-0001Jd-3P for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 30 Apr 2020 03:57:10 +0200 Original-Received: from localhost ([::1]:45180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTyRp-000682-2q for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Apr 2020 21:57:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36038) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTyRj-00067s-Ee for bug-gnu-emacs@gnu.org; Wed, 29 Apr 2020 21:57:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jTyRj-0000oo-27 for bug-gnu-emacs@gnu.org; Wed, 29 Apr 2020 21:57:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33463) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jTyRi-0000oh-Lz for bug-gnu-emacs@gnu.org; Wed, 29 Apr 2020 21:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jTyRi-00060c-K4 for bug-gnu-emacs@gnu.org; Wed, 29 Apr 2020 21:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 30 Apr 2020 01:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 40974 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.158821180423073 (code B ref -1); Thu, 30 Apr 2020 01:57:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Apr 2020 01:56:44 +0000 Original-Received: from localhost ([127.0.0.1]:45009 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jTyRP-000604-Rr for submit@debbugs.gnu.org; Wed, 29 Apr 2020 21:56:44 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:50446) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jTyRO-0005zx-4X for submit@debbugs.gnu.org; Wed, 29 Apr 2020 21:56:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35976) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTyRN-00064k-I8 for bug-gnu-emacs@gnu.org; Wed, 29 Apr 2020 21:56:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jTyRL-0000Hw-RI for bug-gnu-emacs@gnu.org; Wed, 29 Apr 2020 21:56:41 -0400 Original-Received: from ericabrahamsen.net ([52.70.2.18]:46988 helo=mail.ericabrahamsen.net) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jTy30-0008GQ-8D for bug-gnu-emacs@gnu.org; Wed, 29 Apr 2020 21:31:30 -0400 Original-Received: from localhost (c-73-254-86-141.hsd1.wa.comcast.net [73.254.86.141]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 04E89FA02A for ; Thu, 30 Apr 2020 01:31:21 +0000 (UTC) Received-SPF: pass client-ip=52.70.2.18; envelope-from=eric@ericabrahamsen.net; helo=mail.ericabrahamsen.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/29 21:31:23 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:179363 Archived-At: --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Prevent-gnus-registry-handle-action-from-creating-sp.patch >From 110fe2e7e0db383d9d1782863324069bece60fd4 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen 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 --=-=-=--