From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#33005: 27.0.50; Data loss with Gnus registry Date: Tue, 03 Dec 2019 09:19:30 +0000 Message-ID: <87lfrtwyu5.fsf@ericabrahamsen.net> References: <871s8yvsrq.fsf@web.de> <87k17nwkxi.fsf@web.de> <8736ebxxwa.fsf@ericabrahamsen.net> <87k17m1tv0.fsf@web.de> <87pnhev5n4.fsf@ericabrahamsen.net> <87sgma1ju2.fsf@web.de> <87imn6v01s.fsf@web.de> <87eexuuznq.fsf@web.de> <87sgm8tmq6.fsf@ericabrahamsen.net> <87wobk0xza.fsf@web.de> <87imn3tv1s.fsf@ericabrahamsen.net> <87imn2luz8.fsf@web.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="202800"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 33005@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 03 10:22:42 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ic4OE-000qYO-Ea for geb-bug-gnu-emacs@m.gmane.org; Tue, 03 Dec 2019 10:22:38 +0100 Original-Received: from localhost ([::1]:50476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ic4OC-0001Ad-1B for geb-bug-gnu-emacs@m.gmane.org; Tue, 03 Dec 2019 04:22:36 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54076) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ic4Ln-00081h-2X for bug-gnu-emacs@gnu.org; Tue, 03 Dec 2019 04:20:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ic4Lj-00073o-19 for bug-gnu-emacs@gnu.org; Tue, 03 Dec 2019 04:20:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33303) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ic4Lh-000730-VX for bug-gnu-emacs@gnu.org; Tue, 03 Dec 2019 04:20:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ic4Lh-00042U-QI for bug-gnu-emacs@gnu.org; Tue, 03 Dec 2019 04:20:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 Dec 2019 09:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33005 X-GNU-PR-Package: emacs Original-Received: via spool by 33005-submit@debbugs.gnu.org id=B33005.157536477915490 (code B ref 33005); Tue, 03 Dec 2019 09:20:01 +0000 Original-Received: (at 33005) by debbugs.gnu.org; 3 Dec 2019 09:19:39 +0000 Original-Received: from localhost ([127.0.0.1]:39276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ic4LL-00041m-4m for submit@debbugs.gnu.org; Tue, 03 Dec 2019 04:19:39 -0500 Original-Received: from ericabrahamsen.net ([52.70.2.18]:49266 helo=mail.ericabrahamsen.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ic4LK-00041V-1B for 33005@debbugs.gnu.org; Tue, 03 Dec 2019 04:19:38 -0500 Original-Received: from localhost (unknown [94.11.255.11]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id E21E0FA08E; Tue, 3 Dec 2019 09:19:31 +0000 (UTC) In-Reply-To: <87imn2luz8.fsf@web.de> (Michael Heerdegen's message of "Fri, 29 Nov 2019 13:36:59 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:172803 Archived-At: --=-=-= Content-Type: text/plain Michael Heerdegen writes: > Eric Abrahamsen writes: > >> I'd be awfully surprised if it only worked for me -- I'd think we >> would have seen bug reports by now. > > My impressions is: some people may have tried using the registry, but > most of them gave up, and nearly nobody is using it. > >> I still blame your usage of debbugs-gnu :) > > I don't. AFAICT the issue happens with (featurep 'debbugs-gnu) ==> nil > all the time. No, I didn't really mean that... Would you try the attached patch? It leaves gnus-registry-db at nil to start with, and also removes the root of the double-loading (which was a problem only because it can potentially be very slow). Thanks, Eric --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Continued-fixes-to-gnus-registry-loading.patch >From ea39e2a7a1969e669c32ef4f883cda357ad144a8 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Tue, 3 Dec 2019 09:12:44 +0000 Subject: [PATCH] Continued fixes to gnus registry loading * lisp/gnus/gnus-registry.el (gnus-registry-db): Do not initialize this variable to an empty database, that should only be done for new databases. (gnus-registry-load): Remove "force" argument, don't check if the database is already loaded, as we're only going to load it once. (gnus-registry-initialize): Either load the db directly, or set up a hook to do it later. (gnus-registry-install-hooks): Don't load on gnus-read-newsrc-el-hook. --- lisp/gnus/gnus-registry.el | 70 ++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 40 deletions(-) diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el index e6fb382c2f..ff4c640c82 100644 --- a/lisp/gnus/gnus-registry.el +++ b/lisp/gnus/gnus-registry.el @@ -340,7 +340,7 @@ gnus-registry-make-db :precious nil :tracked nil))) -(defvar gnus-registry-db (gnus-registry-make-db) +(defvar gnus-registry-db nil "The article registry by Message ID. See `registry-db'.") ;; top-level registry data management @@ -352,40 +352,33 @@ gnus-registry-remake-db (gnus-message 4 "Remaking the Gnus registry") (setq gnus-registry-db (gnus-registry-make-db)))) -(defun gnus-registry-load (&optional force) - "Load the registry from the cache file. -If the registry is already loaded, don't reload unless FORCE is -non-nil." +(defun gnus-registry-load () + "Load the registry from the cache file." (interactive) - (when (or force - ;; The registry is loaded by both - ;; `gnus-registry-initialize' and the read-newsrc hook. - ;; Don't load twice. - (null (eieio-object-p gnus-registry-db))) - (let ((file gnus-registry-cache-file)) - (condition-case nil - (gnus-registry-read file) - (file-error - ;; Fix previous mis-naming of the registry file. - (let ((old-file-name - (concat (file-name-sans-extension - gnus-registry-cache-file) - ".eioio"))) - (if (and (file-exists-p old-file-name) - (yes-or-no-p - (format "Rename registry file from %s to %s? " - old-file-name file))) - (progn - (gnus-registry-read old-file-name) - (setf (oref gnus-registry-db file) file) - (gnus-message 1 "Registry filename changed to %s" file)) - (gnus-registry-remake-db t)))) - (error - (gnus-message - 1 - "The Gnus registry could not be loaded from %s, creating a new one" - file) - (gnus-registry-remake-db t)))))) + (let ((file gnus-registry-cache-file)) + (condition-case nil + (gnus-registry-read file) + (file-error + ;; Fix previous mis-naming of the registry file. + (let ((old-file-name + (concat (file-name-sans-extension + gnus-registry-cache-file) + ".eioio"))) + (if (and (file-exists-p old-file-name) + (yes-or-no-p + (format "Rename registry file from %s to %s? " + old-file-name file))) + (progn + (gnus-registry-read old-file-name) + (setf (oref gnus-registry-db file) file) + (gnus-message 1 "Registry filename changed to %s" file)) + (gnus-registry-remake-db t)))) + (error + (gnus-message + 1 + "The Gnus registry could not be loaded from %s, creating a new one" + file) + (gnus-registry-remake-db t))))) (defun gnus-registry-read (file) "Do the actual reading of the registry persistence file." @@ -1178,13 +1171,12 @@ gnus-registry-initialize (gnus-message 5 "Initializing the registry") (gnus-registry-install-hooks) (gnus-registry-install-shortcuts) - (gnus-registry-load)) + (if (gnus-alive-p) + (gnus-registry-load) + (add-hook 'gnus-read-newsrc-el-hook 'gnus-registry-load))) -;; FIXME: Why autoload this function? -;;;###autoload (defun gnus-registry-install-hooks () "Install the registry hooks." - (interactive) (setq gnus-registry-enabled t) (add-hook 'gnus-summary-article-move-hook 'gnus-registry-action) (add-hook 'gnus-summary-article-delete-hook 'gnus-registry-action) @@ -1192,13 +1184,11 @@ gnus-registry-install-hooks (add-hook 'nnmail-spool-hook 'gnus-registry-spool-action) (add-hook 'gnus-save-newsrc-hook 'gnus-registry-save) - (add-hook 'gnus-read-newsrc-el-hook 'gnus-registry-load) (add-hook 'gnus-summary-prepare-hook 'gnus-registry-register-message-ids)) (defun gnus-registry-unload-hook () "Uninstall the registry hooks." - (interactive) (remove-hook 'gnus-summary-article-move-hook 'gnus-registry-action) (remove-hook 'gnus-summary-article-delete-hook 'gnus-registry-action) (remove-hook 'gnus-summary-article-expire-hook 'gnus-registry-action) -- 2.24.0 --=-=-=--