GNU bug report logs - #64117
28.2; "gnus-request-set-mark: Buffer is read-only" when exiting agentized, unplugged summary buffer

Previous Next

Package: emacs;

Reported by: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>

Date: Fri, 16 Jun 2023 18:59:01 UTC

Severity: normal

Found in version 28.2

Done: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>

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 64117 in the body.
You can then email your comments to 64117 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#64117; Package emacs. (Fri, 16 Jun 2023 18:59:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 16 Jun 2023 18:59:01 GMT) Full text and rfc822 format available.

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

From: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.2; "gnus-request-set-mark: Buffer is read-only" when exiting
 agentized, unplugged summary buffer
Date: Fri, 16 Jun 2023 20:58:05 +0200
This issue should be also present in Emacs master, judging by the
code.  However I have reproduced this issue only in my
"production Emacs" on 28.2 and, in particular, *not* in an "emacs
-Q" environment.  Gnus setup complete with IMAP and all is
finicky, so probably you accept this bug report without all that.

Here are the steps to reproduce the issue:

- Ensure you have an agentized nnimap group G with some unread
  articles.

- Ensure Gnus is unplugged.

- Enter group G from the *Group* buffer by pressing "RET" on it.

- Mark some unread articles in the summary buffer of G as "read"
  by positioning point on them and pressing "d".

- Exit group G from the summary buffer by pressing "q".

The last step results in an error

  gnus-request-set-mark: Buffer is read-only: #<buffer *Summary 
nnimap+<host>:INBOX*>

for me.

Expected result is that the agent writes the information on the
marks that have changed while unplugged to a separate file which
it later, when Gnus gets plugged again, replays.

The reason for the bug us most likely commit


https://git.savannah.gnu.org/cgit/emacs.git/commit/src?id=cb12a84f2c519a48dd87453c925e3bc36d9944db

and here the change

  * lisp/gnus/nnagent.el: Don't use a unibyte buffer.

The author has removed a macro call to `mm-with-unibyte-buffer'
in function `nnagent-request-set-mark' without replacing it by,
for example, a call to `with-temp-buffer'.  Accordingly, function
`nnagent-request-set-mark' tries to operate on the current
buffer, which happens to be the read-only summary buffer.

Adding a `with-temp-buffer' around the inserts and the call to
`write-region' fixes this issue (showing 28.2-based code):

(deffoo nnagent-request-set-mark (group action server)
  (with-temp-buffer
    (insert "(gnus-agent-synchronize-group-flags \""
	    group
	    "\" '")
    (gnus-pp action)
    (insert " \""
	    (gnus-method-to-server gnus-command-method)
	    "\"")
    (insert ")\n")
    (let ((coding-system-for-write nnheader-file-coding-system))
      (write-region (point-min) (point-max) (gnus-agent-lib-file "flags")
		    t 'silent)))
  ;; Also set the marks for the original back end that keeps marks in
  ;; the local system.
  (let ((gnus-agent nil))
    (when (and (memq (car gnus-command-method) '(nntp))
	       (gnus-check-backend-function 'request-set-mark
					    (car gnus-command-method)))
      (funcall (gnus-get-function gnus-command-method 'request-set-mark)
	       group action server)))
  nil)

I could provide a patch on emacs-29 but only without actually
testing it...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64117; Package emacs. (Wed, 21 Jun 2023 13:14:01 GMT) Full text and rfc822 format available.

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

From: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>
To: Andrew G Cohen <cohen <at> andy.bu.edu>
Cc: 64117 <at> debbugs.gnu.org
Subject: Re: 28.2; "gnus-request-set-mark: Buffer is read-only" when exiting
 agentized, unplugged summary buffer
Date: Wed, 21 Jun 2023 15:13:17 +0200
Hi Andrew,

you already have helped me out with a Gnus problem - probably could you
have a look at this one as well?  Looks simple enough, only I wonder why
nobody has complained earlier ...

BTW, is there a more appropriate ML to report Gnus issues than the
generic Emacs one?  And how about development questions related to Gnus?
info-gnus-english looks so abandoned ... I hope Gnus isn't.

Thanks!

Jens





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64117; Package emacs. (Wed, 21 Jun 2023 13:54:02 GMT) Full text and rfc822 format available.

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

From: Andrew Cohen <cohen <at> bu.edu>
To: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>
Cc: 64117 <at> debbugs.gnu.org, Eric Abrahamsen <eric <at> ericabrahamsen.net>,
 Andrew G Cohen <cohen <at> andy.bu.edu>
Subject: Re: 28.2; "gnus-request-set-mark: Buffer is read-only" when exiting
 agentized, unplugged summary buffer
Date: Wed, 21 Jun 2023 21:52:53 +0800
>>>>> "JS" == Jens Schmidt <jschmidt4gnu <at> vodafonemail.de> writes:

    JS> Hi Andrew, you already have helped me out with a Gnus problem -
    JS> probably could you have a look at this one as well?  Looks
    JS> simple enough, only I wonder why nobody has complained earlier
    JS> ...

I don't think many people are using the features that hit this code path
(I don't use the agent, for example). But the problem and your fix seems
pretty obvious.  This is Eric's code, so I am copying him to confirm.
Since he might be busy, if he doesn't respond in a few days I think I'll
go ahead and push this fix to master.

Eli, this error was introduced almost 4 years ago but probably counts as
a regression. Should we consider also fixing on 29? (Adding the use of a
temp buffer is pretty unlikely to cause any problems).

    JS> BTW, is there a more appropriate ML to report Gnus issues than
    JS> the generic Emacs one?  And how about development questions
    JS> related to Gnus?  info-gnus-english looks so abandoned ... I
    JS> hope Gnus isn't.

Gnus certainly isn't dead, although there aren't many of us working on
new features. The lists that still see (light) traffic are
emacs.gnus.general and emacs.gnus.user (which I use through gmane), and
you can certainly post there. 

Best,
Andy

-- 
Andrew Cohen




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64117; Package emacs. (Wed, 21 Jun 2023 14:15:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andrew Cohen <cohen <at> bu.edu>
Cc: 64117 <at> debbugs.gnu.org, eric <at> ericabrahamsen.net,
 jschmidt4gnu <at> vodafonemail.de, cohen <at> andy.bu.edu
Subject: Re: bug#64117: 28.2;
 "gnus-request-set-mark: Buffer is read-only" when exiting agentized,
 unplugged summary buffer
Date: Wed, 21 Jun 2023 17:14:05 +0300
> Cc: 64117 <at> debbugs.gnu.org, Eric Abrahamsen <eric <at> ericabrahamsen.net>,
>  Andrew G Cohen <cohen <at> andy.bu.edu>
> From: Andrew Cohen <cohen <at> bu.edu>
> Date: Wed, 21 Jun 2023 21:52:53 +0800
> 
> Eli, this error was introduced almost 4 years ago but probably counts as
> a regression. Should we consider also fixing on 29? (Adding the use of a
> temp buffer is pretty unlikely to cause any problems).

Please show the patch, it is hard to decide without a good idea what
is about to change.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64117; Package emacs. (Wed, 21 Jun 2023 14:23:02 GMT) Full text and rfc822 format available.

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

From: Andrew Cohen <cohen <at> bu.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Andrew Cohen <cohen <at> bu.edu>, 64117 <at> debbugs.gnu.org, eric <at> ericabrahamsen.net,
 jschmidt4gnu <at> vodafonemail.de, cohen <at> andy.bu.edu
Subject: Re: bug#64117: 28.2; "gnus-request-set-mark: Buffer is read-only"
 when exiting agentized, unplugged summary buffer
Date: Wed, 21 Jun 2023 22:22:37 +0800
>>>>> "EZ" == Eli Zaretskii <eliz <at> gnu.org> writes:

[...]

    EZ> Please show the patch, it is hard to decide without a good idea
    EZ> what is about to change.

Oops, sorry. Here it is (the change just wraps the bulk of a function
with (with-temp-buffer ...))


@@ -118,17 +118,18 @@ nnagent-request-post
   (gnus-request-accept-article "nndraft:queue" nil t t))
 
 (deffoo nnagent-request-set-mark (group action server)
-  (insert "(gnus-agent-synchronize-group-flags \""
-	  group
-	  "\" '")
-  (gnus-pp action)
-  (insert " \""
-	  (gnus-method-to-server gnus-command-method)
-	  "\"")
-  (insert ")\n")
-  (let ((coding-system-for-write nnheader-file-coding-system))
-    (write-region (point-min) (point-max) (gnus-agent-lib-file "flags")
-		  t 'silent))
+  (with-temp-buffer
+    (insert "(gnus-agent-synchronize-group-flags \""
+	    group
+	    "\" '")
+    (gnus-pp action)
+    (insert " \""
+	    (gnus-method-to-server gnus-command-method)
+	    "\"")
+    (insert ")\n")
+    (let ((coding-system-for-write nnheader-file-coding-system))
+      (write-region (point-min) (point-max) (gnus-agent-lib-file "flags")
+		    t 'silent)))
   ;; Also set the marks for the original back end that keeps marks in
   ;; the local system.
   (let ((gnus-agent nil))

-- 
Andrew Cohen




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64117; Package emacs. (Wed, 21 Jun 2023 14:35:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andrew Cohen <cohen <at> bu.edu>
Cc: 64117 <at> debbugs.gnu.org, eric <at> ericabrahamsen.net,
 jschmidt4gnu <at> vodafonemail.de, cohen <at> andy.bu.edu
Subject: Re: bug#64117: 28.2; "gnus-request-set-mark: Buffer is read-only"
 when exiting agentized, unplugged summary buffer
Date: Wed, 21 Jun 2023 17:34:51 +0300
> From: Andrew Cohen <cohen <at> bu.edu>
> Cc: Andrew Cohen <cohen <at> bu.edu>,  jschmidt4gnu <at> vodafonemail.de,
>   64117 <at> debbugs.gnu.org,  eric <at> ericabrahamsen.net,  cohen <at> andy.bu.edu
> Date: Wed, 21 Jun 2023 22:22:37 +0800
> 
> >>>>> "EZ" == Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> [...]
> 
>     EZ> Please show the patch, it is hard to decide without a good idea
>     EZ> what is about to change.
> 
> Oops, sorry. Here it is (the change just wraps the bulk of a function
> with (with-temp-buffer ...))

Thanks, this is okay for emacs-29.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64117; Package emacs. (Sat, 01 Jul 2023 21:07:02 GMT) Full text and rfc822 format available.

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

From: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>
To: Eli Zaretskii <eliz <at> gnu.org>, Andrew Cohen <cohen <at> bu.edu>
Cc: 64117 <at> debbugs.gnu.org, eric <at> ericabrahamsen.net, cohen <at> andy.bu.edu
Subject: Re: bug#64117: 28.2; "gnus-request-set-mark: Buffer is read-only"
 when exiting agentized, unplugged summary buffer
Date: Sat, 1 Jul 2023 23:05:38 +0200
On 2023-06-21  16:34, Eli Zaretskii wrote:

> Thanks, this is okay for emacs-29.

Andrew's fix is already in Emacs 29 and master (thanks).  Should I close 
this bug or do we still wait for Eric's feedback?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64117; Package emacs. (Sat, 01 Jul 2023 22:53:01 GMT) Full text and rfc822 format available.

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

From: Andrew Cohen <cohen <at> andy.bu.edu>
To: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>
Cc: Andrew Cohen <cohen <at> bu.edu>, 64117 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz <at> gnu.org>, eric <at> ericabrahamsen.net
Subject: Re: bug#64117: 28.2; "gnus-request-set-mark: Buffer is read-only"
 when exiting agentized, unplugged summary buffer
Date: Sun, 2 Jul 2023 06:52:14 +0800 (GMT+08:00)
Please go ahead and close.

Jul 2, 2023 05:06:06 Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>:

> On 2023-06-21  16:34, Eli Zaretskii wrote:
>
>> Thanks, this is okay for emacs-29.
>
> Andrew's fix is already in Emacs 29 and master (thanks).  Should I 
> close this bug or do we still wait for Eric's feedback?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64117; Package emacs. (Sat, 01 Jul 2023 23:55:02 GMT) Full text and rfc822 format available.

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

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: Andrew Cohen <cohen <at> andy.bu.edu>
Cc: Andrew Cohen <cohen <at> bu.edu>, 64117 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz <at> gnu.org>, Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>
Subject: Re: bug#64117: 28.2; "gnus-request-set-mark: Buffer is read-only"
 when exiting agentized, unplugged summary buffer
Date: Sat, 01 Jul 2023 16:54:44 -0700
On 07/02/23 06:52 AM, Andrew Cohen wrote:
> Please go ahead and close.
>
> Jul 2, 2023 05:06:06 Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>:
>
>> On 2023-06-21  16:34, Eli Zaretskii wrote:
>>
>>> Thanks, this is okay for emacs-29.
>>
>> Andrew's fix is already in Emacs 29 and master (thanks).  Should I
>> close this bug or do we still wait for Eric's feedback?

Thanks to all for taking care of this!




Reply sent to Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>:
You have taken responsibility. (Sun, 02 Jul 2023 07:16:01 GMT) Full text and rfc822 format available.

Notification sent to Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>:
bug acknowledged by developer. (Sun, 02 Jul 2023 07:16:01 GMT) Full text and rfc822 format available.

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

From: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>
To: Eric Abrahamsen <eric <at> ericabrahamsen.net>, Andrew Cohen <cohen <at> andy.bu.edu>
Cc: Andrew Cohen <cohen <at> bu.edu>, 64117-done <at> debbugs.gnu.org,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#64117: 28.2; "gnus-request-set-mark: Buffer is read-only"
 when exiting agentized, unplugged summary buffer
Date: Sun, 2 Jul 2023 09:14:59 +0200
On 2023-07-02  01:54, Eric Abrahamsen wrote:

> Thanks to all for taking care of this!

Same here.

Closed.





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

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

Previous Next


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