unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: James Thomas <jimjoe@gmx.net>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: 65467@debbugs.gnu.org
Subject: bug#65467: 29.1.50; Gnus agent groups with spaces in their names cannot be activated while unplugged
Date: Thu, 24 Aug 2023 05:40:29 +0530	[thread overview]
Message-ID: <87h6op47wq.fsf@gmx.net> (raw)
In-Reply-To: <871qftmlve.fsf@gmx.net> (James Thomas's message of "Thu, 24 Aug 2023 04:01:33 +0530")

James Thomas wrote:

> Eric Abrahamsen wrote:
>
>> James Thomas writes:
>>
>>> To reproduce, attempt to access, while unplugged, any group of an
>>> agentized (IMAP) server with a space in its name (such as Gmail's 'Sent
>>> Mail' or 'All Mail').
>>>
>>> Here's a patch that fixes it:
>>>
>>> diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el
>>> index db205c5b657..5f2401c7c07 100644
>>> --- a/lisp/gnus/gnus-agent.el
>>> +++ b/lisp/gnus/gnus-agent.el
>>> @@ -1340,13 +1340,13 @@ gnus-agent-save-group-info
>>>
>>>            (goto-char (point-min))
>>>            (when (re-search-forward
>>> -                 (concat "^" (regexp-quote group) " ") nil t)
>>> +                 (concat "^\"?" (regexp-quote group) "\"? ") nil t)
>>>              (save-excursion
>>>                (setq oactive-max (read (current-buffer))	  ;; max
>>>                      oactive-min (read (current-buffer)))) ;; min
>>>              (gnus-delete-line)))
>>>  	(when active
>>> -	  (insert (format "%s %d %d y\n" group
>>> +	  (insert (format "%S %d %d y\n" group
>>>  			  (max (or oactive-max (cdr active)) (cdr active))
>>>  			  (min (or oactive-min (car active)) (car active))))
>>>  	  (goto-char (point-max))
>>> @@ -1370,7 +1370,7 @@ gnus-agent-get-group-info
>>>
>>>            (goto-char (point-min))
>>>            (when (re-search-forward
>>> -                 (concat "^" (regexp-quote group) " ") nil t)
>>> +                 (concat "^\"?" (regexp-quote group) "\"? ") nil t)
>>>              (save-excursion
>>>                (setq oactive-max (read (current-buffer))	;; max
>>>                      oactive-min (read (current-buffer))) ;; min
>>> diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el
>>> index e8f157392d4..3a91139cb3f 100644
>>> --- a/lisp/gnus/nnmail.el
>>> +++ b/lisp/gnus/nnmail.el
>>> @@ -695,7 +697,7 @@ nnmail-generate-active
>>>    (erase-buffer)
>>>    (let (group)
>>>      (while (setq group (pop alist))
>>> -      (insert (format "%s %d %d y\n" (car group) (cdadr group)
>>> +      (insert (format "%S %d %d y\n" (car group) (cdadr group)
>>>  		      (caadr group))))
>>>      (goto-char (point-max))
>>>      (while (search-backward "\\." nil t)
>>>
>>> Note: If you're already facing this problem with a group, after applying
>>> the patch, you'll also have to do M-g over it in the Group buffer while
>>> plugged, to update the agent's active file. New servers wouldn't need
>>> this.
>>>
>>> This is similar in spirit to bug#42823.
>>
>> I'm thinking about ways in which this change might be able to break
>> users' existing set ups. It looks to me like it will be a "silent
>> upgrade" as the group names will be replaced with their quoted versions.
>>
>> But that means that users will not be able to downgrade their Gnus
>> (versions of Gnus without this change won't be able to read active files
>> written with this change in place), which I think is a contract we try
>> to stick to. Do we? I can't remember.
>
> Hmmm...
>

Perhaps we can commit only the 'reading' parts (1st change in the first
2 hunks) and hold off on the 'writing' parts for a later, minor release
(which wouldn't have drastic changes) so that people know (for one
release) that any breakage is not due to that.

>> In general it's annoying that different parts of Gnus use different
>> routines for reading/writing active files...
>
> At least for this point: I've checked that all results of a grep for '%s
> %d' or '(regexp-quote .*group.*)' in the gnus code are covered. These
> should be the ones not using 'read'.

That should read '(regexp-quote[ \n\t]+.*group.*)' (in effect, through
Dired's M-s a C-M-s).

--





      reply	other threads:[~2023-08-24  0:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23  7:07 bug#65467: 29.1.50; Gnus agent groups with spaces in their names cannot be activated while unplugged James Thomas
2023-08-23 17:17 ` Eric Abrahamsen
2023-08-23 22:31   ` James Thomas
2023-08-24  0:10     ` James Thomas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h6op47wq.fsf@gmx.net \
    --to=jimjoe@gmx.net \
    --cc=65467@debbugs.gnu.org \
    --cc=eric@ericabrahamsen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).