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: Thu, 17 Oct 2019 08:53:11 -0700 Message-ID: <87sgnr74ig.fsf@ericabrahamsen.net> References: <871s8yvsrq.fsf@web.de> <87in29x33z.fsf@ericabrahamsen.net> <87r2gxygox.fsf@web.de> <87efcxwzr2.fsf@ericabrahamsen.net> <874ldtlcks.fsf@web.de> <87ftxdl7w1.fsf@ericabrahamsen.net> <878t33cjf2.fsf@web.de> <87o8za4gbl.fsf@web.de> <87mueuicys.fsf@ericabrahamsen.net> <87d0fgnik0.fsf@ericabrahamsen.net> <87v9srzm9g.fsf@web.de> <87ftjvz045.fsf@ericabrahamsen.net> <87tv8ajd6d.fsf@web.de> <87lftlsr90.fsf@ericabrahamsen.net> <87h849xds3.fsf@web.de> <87eezcpuac.fsf@ericabrahamsen.net> <87lftjkcj7.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="246826"; 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 Thu Oct 17 18:38:47 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 1iL8nX-00122z-FR for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 Oct 2019 18:38:47 +0200 Original-Received: from localhost ([::1]:52852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL8nV-0006NS-OH for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 Oct 2019 12:38:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33389) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL86G-0001Lc-9Q for bug-gnu-emacs@gnu.org; Thu, 17 Oct 2019 11:54:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iL86E-00011G-Iz for bug-gnu-emacs@gnu.org; Thu, 17 Oct 2019 11:54:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39954) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iL86E-00011C-FS for bug-gnu-emacs@gnu.org; Thu, 17 Oct 2019 11:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iL86E-0000Le-AS for bug-gnu-emacs@gnu.org; Thu, 17 Oct 2019 11:54: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, 17 Oct 2019 15:54:02 +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.15713276031241 (code B ref 33005); Thu, 17 Oct 2019 15:54:02 +0000 Original-Received: (at 33005) by debbugs.gnu.org; 17 Oct 2019 15:53:23 +0000 Original-Received: from localhost ([127.0.0.1]:48771 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL85a-0000Jx-Jh for submit@debbugs.gnu.org; Thu, 17 Oct 2019 11:53:22 -0400 Original-Received: from ericabrahamsen.net ([52.70.2.18]:50622 helo=mail.ericabrahamsen.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL85Y-0000JT-2b for 33005@debbugs.gnu.org; Thu, 17 Oct 2019 11:53:20 -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 3AD58FA028; Thu, 17 Oct 2019 15:53:13 +0000 (UTC) In-Reply-To: <87lftjkcj7.fsf@web.de> (Michael Heerdegen's message of "Thu, 17 Oct 2019 10:21:32 +0200") 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:169594 Archived-At: Michael Heerdegen writes: > Eric Abrahamsen writes: > >> People are expected to use `gnus-mock-start' to start it, which does >> "emacs -Q" internally. > > Ah, I remember. > >> The only requirement is that the emacs be run >> from a build directory, and not an installation. > > I tried it from my normal Emacs session and got this: > > Debugger entered--Lisp error: (buffer-read-only #) > replace-match("/tmp/emacs-gnus-mock-738lXO" t) > gnus-mock-start() > funcall-interactively(gnus-mock-start) > call-interactively(gnus-mock-start record nil) > command-execute(gnus-mock-start record) > > Is that because it is an installed Emacs, or something else? Should I > investigate? Man, who would have guessed this would be so difficult... I have no idea why a data file that ships with the package would become read-only. I suppose I could wrap that in `inhibit-read-only', but if it's read only for a reason that will only fail later down the line. Can you check two things, and then I'll give up for now? 1. Put a breakpoint or edebug or otherwise slow the function down, and after the data directory has been copied to /tmp, make sure that it belongs to your user and you have the right permissions? 2. Try this version of gnus-mock-start and see if it works: (defun gnus-mock-start () (interactive) (let ((mock-tmp-dir (make-temp-file "emacs-gnus-mock-" t))) (condition-case-unless-debug err (let ((init-file (expand-file-name "init.el" mock-tmp-dir))) (with-temp-buffer (let ((standard-output (current-buffer)) (print-circle nil)) (prin1 `(setq gnus-home-directory ,mock-tmp-dir init-file-user "mockturtle" sendmail-program ,(expand-file-name gnus-mock-sendmail-program mock-tmp-dir) message-directory ,mock-tmp-dir gnus-startup-file ,(expand-file-name ".newsrc" mock-tmp-dir) gnus-init-file ,(expand-file-name ".gnus.el" mock-tmp-dir) nndraft-directory ,(expand-file-name "drafts/" mock-tmp-dir) gnus-agent-directory ,(expand-file-name "agent/" mock-tmp-dir) gnus-directory ,(expand-file-name "News/" mock-tmp-dir))) (princ "\n\n") ;; Constant that can be checked if we need to know it's a mock ;; session. (prin1 '(defconst gnus-mock-p t)) (princ "\n") ;; Constant for use in `gnus-mock-reload', which is defined in ;; the .gnus.el startup file. (prin1 `(defconst gnus-mock-data-dir ,gnus-mock-data-dir)) (when gnus-mock-cleanup-p (princ "\n") (prin1 `(add-hook 'kill-emacs-hook (lambda () (delete-directory ,mock-tmp-dir t))))) (when gnus-mock-use-images (princ "\n") (prin1 `(add-to-list 'load-path ,(format "%s/data" mock-tmp-dir)))) (write-file init-file))) ;; Put our data and config in place. (copy-directory gnus-mock-data-dir (file-name-as-directory mock-tmp-dir) nil nil t) ;; Git doesn't let us commit empty directories, so create our ;; necessary empty maildir bits, and draft directories. (mapc (lambda (path) (make-directory path t)) (mapcar (lambda (dir) (format "%s/test/%s" mock-tmp-dir dir)) '("Welcome/new" "Welcome/tmp" "Welcome/.nnmaildir/marks" "incoming/tmp" "incoming/new" "incoming/cur" "incoming/.nnmaildir/marks" "incoming/.nnmaildir/nov" "mails/tmp" "mails/new" "mails/.nnmaildir/marks"))) (make-directory (format "%s/drafts/drafts" mock-tmp-dir) t) (make-directory (format "%s/drafts/queue" mock-tmp-dir)) ;; Possibly insert additional config. (when gnus-mock-init-file (with-temp-buffer (insert-file-contents gnus-mock-init-file) (append-to-file (point-min) (point-max) init-file))) (when gnus-mock-gnus-file (with-temp-buffer (insert-file-contents gnus-mock-gnus-file) (append-to-file (point-min) (point-max) (expand-file-name ".gnus.el" mock-tmp-dir)))) ;; Possibly add an nnimap server. (when gnus-mock-dovecot-imap-program (with-temp-buffer (insert "\n\n") (prin1 `(add-to-list 'gnus-secondary-select-methods (quote (nnimap "Mocky" (nnimap-stream shell) (nnimap-shell-program ,(concat gnus-mock-dovecot-imap-program (format " -o mail_location=maildir:%s/imapmail/mail" mock-tmp-dir)))))) (current-buffer)) (append-to-file (point-min) (point-max) (expand-file-name ".gnus.el" mock-tmp-dir)))) ;; There are absolute paths in the .newsrc.eld file, so doctor ;; that file. (let ((inhibit-read-only t)) (with-current-buffer (find-file-noselect (expand-file-name ".newsrc.eld" mock-tmp-dir)) (while (re-search-forward "REPLACE_ME" (point-max) t) (replace-match mock-tmp-dir t)) (when gnus-mock-dovecot-imap-program (goto-char (point-max)) (insert "\n\n") (prin1 '(setq gnus-newsrc-alist (append gnus-newsrc-alist '(("nnimap+Mocky:INBOX" 3 nil ((unexist) (seen (1 . 32))) "nnimap:Mocky" ((modseq . "33") (uidvalidity . "1541087103") (active 1 . 32) (permanent-flags %Answered %Flagged %Deleted %Seen %Draft %*))) ("nnimap+Mocky:emacs-devel" 3 nil ((unexist 0)) "nnimap:Mocky" ((modseq . "21") (uidvalidity . "1541087104") (active 0 . 20) (permanent-flags %Answered %Flagged %Deleted %Seen %Draft %*))) ("nnimap+Mocky:\320\237\321\200\320\270\320\262\320\265\321\202\320\274\320\270\321\200" 3 nil ((unexist) (seen 1)) "nnimap:Mocky" ((modseq . "2") (uidvalidity . "1541087105") (active 1 . 1) (permanent-flags %Answered %Flagged %Deleted %Seen %Draft %*)))))) (current-buffer))) (basic-save-buffer))) (let ((default-directory (expand-file-name "lisp/gnus" (file-name-as-directory (expand-file-name "../.." gnus-mock-emacs-program))))) (make-process :name "gnus-mock" :buffer nil :command (list gnus-mock-emacs-program "-Q" "--load" init-file) :stderr "*gnus mock errors*"))) (error (when (and gnus-mock-cleanup-p (file-exists-p mock-tmp-dir)) (delete-directory mock-tmp-dir t)) (signal (car err) (cdr err))))))