[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#65467: 29.1.50; Gnus agent groups with spaces in their names cannot
From: |
James Thomas |
Subject: |
bug#65467: 29.1.50; Gnus agent groups with spaces in their names cannot be activated while unplugged |
Date: |
Thu, 24 Aug 2023 04:01:33 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
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...
> 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'.
--