GNU bug report logs - #69517
[PATCH] Make gnus cache work with group names having '/'

Previous Next

Package: emacs;

Reported by: James Thomas <jimjoe <at> gmx.net>

Date: Sun, 3 Mar 2024 01:56:01 UTC

Severity: normal

Tags: patch

Done: Eric Abrahamsen <eric <at> ericabrahamsen.net>

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 69517 in the body.
You can then email your comments to 69517 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#69517; Package emacs. (Sun, 03 Mar 2024 01:56:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to James Thomas <jimjoe <at> gmx.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 03 Mar 2024 01:56:02 GMT) Full text and rfc822 format available.

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

From: James Thomas <jimjoe <at> gmx.net>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Make gnus cache work with group names having '/'
Date: Sun, 03 Mar 2024 07:22:29 +0530
[Message part 1 (text/plain, inline)]
Tags: patch

Reproduction steps:

- Setup Gnus with any group name having a slash ('/') such as
  "[Gmail]/Drafts" or an Atom feed (they usually have slashes) using the
  patch in bug#66188.

- Press '*' on a message in the group.

- Do (info "(gnus) Creating a Virtual Server")

- Open the above from the Server buffer; RET on the new group fails.

A patch is attached. I couldn't find the problematic commit or its
original branch (where it was a consolidated merge from) but
'gnus-use-long-file-names' is apparently not meant for backends: it
can't even be customized with that 'not-cache' option. I think this is
the right way to solve it: the other lines removed in this patch are
even older, but they were never being called due to the above reason.

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.33, cairo version 1.16.0) of 2024-02-20 built on
 user-Inspiron-15-5518
Repository revision: 466800591c2bd674b0b967205147d7519da7e1a4
Repository branch: nnatom-master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Ubuntu 22.04.3 LTS

[0001-Make-gnus-cache-work-with-group-names-having.patch (text/patch, attachment)]
[Message part 3 (text/plain, inline)]
--

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69517; Package emacs. (Sat, 09 Mar 2024 08:44:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: James Thomas <jimjoe <at> gmx.net>, Eric Abrahamsen <eric <at> ericabrahamsen.net>
Cc: 69517 <at> debbugs.gnu.org
Subject: Re: bug#69517: [PATCH] Make gnus cache work with group names having
 '/'
Date: Sat, 09 Mar 2024 10:42:43 +0200
> Date: Sun, 03 Mar 2024 07:22:29 +0530
> From:  James Thomas via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Tags: patch
> 
> Reproduction steps:
> 
> - Setup Gnus with any group name having a slash ('/') such as
>   "[Gmail]/Drafts" or an Atom feed (they usually have slashes) using the
>   patch in bug#66188.
> 
> - Press '*' on a message in the group.
> 
> - Do (info "(gnus) Creating a Virtual Server")
> 
> - Open the above from the Server buffer; RET on the new group fails.
> 
> A patch is attached. I couldn't find the problematic commit or its
> original branch (where it was a consolidated merge from) but
> 'gnus-use-long-file-names' is apparently not meant for backends: it
> can't even be customized with that 'not-cache' option. I think this is
> the right way to solve it: the other lines removed in this patch are
> even older, but they were never being called due to the above reason.

Eric, could you please review the patch and install if it's okay?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69517; Package emacs. (Sat, 09 Mar 2024 21:58:01 GMT) Full text and rfc822 format available.

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

From: James Thomas <jimjoe <at> gmx.net>
To: 69517 <at> debbugs.gnu.org
Cc: Eric Abrahamsen <eric <at> ericabrahamsen.net>, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#69517: [PATCH] Make gnus cache work with group names having
 '/'
Date: Sun, 10 Mar 2024 03:26:23 +0530
Eli Zaretskii wrote:

>> Date: Sun, 03 Mar 2024 07:22:29 +0530
>> From:  James Thomas via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>
>> Tags: patch
>>
>> Reproduction steps:
>>
>> - Setup Gnus with any group name having a slash ('/') such as
>>   "[Gmail]/Drafts" or an Atom feed (they usually have slashes) using the
>>   patch in bug#66188.
>>
>> - Press '*' on a message in the group.
>>
>> - Do (info "(gnus) Creating a Virtual Server")
>>
>> - Open the above from the Server buffer; RET on the new group fails.
>>
>> A patch is attached. I couldn't find the problematic commit or its
>> original branch (where it was a consolidated merge from) but
>> 'gnus-use-long-file-names' is apparently not meant for backends: it
>> can't even be customized with that 'not-cache' option. I think this is
>> the right way to solve it: the other lines removed in this patch are
>> even older, but they were never being called due to the above reason.
>
> Eric, could you please review the patch and install if it's okay?
>
> Thanks.

There's a small caveat after applying this:

Before this patch, cache entries would've effectively ignored
'nnmail-use-long-file-names' (nil by default) and used long names. After
this patch new entries would honor it, resulting in an extra directory
tree for the same group. But only the original one would be opened (due
to [[./lisp/gnus/nnmail.el::;; If this direc]]). To fix it, one would
have to copy all the files in from the original directory into the new
one (and retain the active file entry). Or of course, change the above
variable (but that could have other implications depending upon one's
configuration).

--




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69517; Package emacs. (Sun, 10 Mar 2024 05:29:01 GMT) Full text and rfc822 format available.

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

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: James Thomas <jimjoe <at> gmx.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 69517 <at> debbugs.gnu.org
Subject: Re: bug#69517: [PATCH] Make gnus cache work with group names having
 '/'
Date: Sat, 09 Mar 2024 21:27:23 -0800
James Thomas <jimjoe <at> gmx.net> writes:

> Eli Zaretskii wrote:
>
>>> Date: Sun, 03 Mar 2024 07:22:29 +0530
>>> From:  James Thomas via "Bug reports for GNU Emacs,
>>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>>
>>> Tags: patch
>>>
>>> Reproduction steps:
>>>
>>> - Setup Gnus with any group name having a slash ('/') such as
>>>   "[Gmail]/Drafts" or an Atom feed (they usually have slashes) using the
>>>   patch in bug#66188.
>>>
>>> - Press '*' on a message in the group.
>>>
>>> - Do (info "(gnus) Creating a Virtual Server")
>>>
>>> - Open the above from the Server buffer; RET on the new group fails.
>>>
>>> A patch is attached. I couldn't find the problematic commit or its
>>> original branch (where it was a consolidated merge from) but
>>> 'gnus-use-long-file-names' is apparently not meant for backends: it
>>> can't even be customized with that 'not-cache' option. I think this is
>>> the right way to solve it: the other lines removed in this patch are
>>> even older, but they were never being called due to the above reason.
>>
>> Eric, could you please review the patch and install if it's okay?
>>
>> Thanks.
>
> There's a small caveat after applying this:
>
> Before this patch, cache entries would've effectively ignored
> 'nnmail-use-long-file-names' (nil by default) and used long names. After
> this patch new entries would honor it, resulting in an extra directory
> tree for the same group. But only the original one would be opened (due
> to [[./lisp/gnus/nnmail.el::;; If this direc]]). To fix it, one would
> have to copy all the files in from the original directory into the new
> one (and retain the active file entry). Or of course, change the above
> variable (but that could have other implications depending upon one's
> configuration).

Thanks for reporting this! Obviously something is wrong here, but I get
different results from your reproduction recipe (I'm running master):
when I create the cache nnml server and hit RET on it, I get:

K      1: nnml:left.right
K      1: nnml:left/right

I am able to subscribe to both groups. When I return to the *Group*
buffer, I can enter the version of the group with the ".", and read the
cached article, while attempting to enter the version with the slash
gives me "Invalid group (no such directory)".

On disk, the "News/cache/active" file starts out with the version with
the ".", and after I create the extra cache server it contains both, it
looks like:

"nnml:left.right" 1 1 y
"nnml:left/right" 1 1 y

Meanwhile, the directory structure "News/cache/nnml:left/right/1" is
created.

The "." in the active file comes from `gnus-cache-generate-active`, and
that mechanism seems to be working fine, at least in my case -- do you
not see that version of the group?

To be honest I have no idea what's happening in `gnus-cache-file-name'.
I'd be hesitant to remove all that code without understanding it better
And I don't think we can argue that that code is "dead" just because it
is behind an option value that isn't one of the customization options.

Anyway, it would be good to first know why you're not seeing the "."
version of the offending filename, and then I guess try to work out
what's going on with the file names. It kind of looks like a collision
between two different mechanisms -- one that translates "/" to "_" to
prevent unwanted filesystem hierarchies, and one that translates between
"/" and "." in order to convert newsgroup-name dot hierarchies into
filesystem hierarchies. In this case, it seems like "long names" and
newsgroup hierarchies shouldn't be applicable at all.

Eric





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69517; Package emacs. (Sun, 10 Mar 2024 18:34:01 GMT) Full text and rfc822 format available.

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

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: James Thomas <jimjoe <at> gmx.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 69517 <at> debbugs.gnu.org
Subject: Re: bug#69517: [PATCH] Make gnus cache work with group names having
 '/'
Date: Sun, 10 Mar 2024 11:33:11 -0700
Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:

> James Thomas <jimjoe <at> gmx.net> writes:
>
>> Eli Zaretskii wrote:
>>
>>>> Date: Sun, 03 Mar 2024 07:22:29 +0530
>>>> From:  James Thomas via "Bug reports for GNU Emacs,
>>>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>>>
>>>> Tags: patch
>>>>
>>>> Reproduction steps:
>>>>
>>>> - Setup Gnus with any group name having a slash ('/') such as
>>>>   "[Gmail]/Drafts" or an Atom feed (they usually have slashes) using the
>>>>   patch in bug#66188.
>>>>
>>>> - Press '*' on a message in the group.
>>>>
>>>> - Do (info "(gnus) Creating a Virtual Server")
>>>>
>>>> - Open the above from the Server buffer; RET on the new group fails.
>>>>
>>>> A patch is attached. I couldn't find the problematic commit or its
>>>> original branch (where it was a consolidated merge from) but
>>>> 'gnus-use-long-file-names' is apparently not meant for backends: it
>>>> can't even be customized with that 'not-cache' option. I think this is
>>>> the right way to solve it: the other lines removed in this patch are
>>>> even older, but they were never being called due to the above reason.
>>>
>>> Eric, could you please review the patch and install if it's okay?
>>>
>>> Thanks.
>>
>> There's a small caveat after applying this:
>>
>> Before this patch, cache entries would've effectively ignored
>> 'nnmail-use-long-file-names' (nil by default) and used long names. After
>> this patch new entries would honor it, resulting in an extra directory
>> tree for the same group. But only the original one would be opened (due
>> to [[./lisp/gnus/nnmail.el::;; If this direc]]). To fix it, one would
>> have to copy all the files in from the original directory into the new
>> one (and retain the active file entry). Or of course, change the above
>> variable (but that could have other implications depending upon one's
>> configuration).
>
> Thanks for reporting this! Obviously something is wrong here, but I get
> different results from your reproduction recipe (I'm running master):
> when I create the cache nnml server and hit RET on it, I get:
>
> K      1: nnml:left.right
> K      1: nnml:left/right
>
> I am able to subscribe to both groups. When I return to the *Group*
> buffer, I can enter the version of the group with the ".", and read the
> cached article, while attempting to enter the version with the slash
> gives me "Invalid group (no such directory)".
>
> On disk, the "News/cache/active" file starts out with the version with
> the ".", and after I create the extra cache server it contains both, it
> looks like:
>
> "nnml:left.right" 1 1 y
> "nnml:left/right" 1 1 y
>
> Meanwhile, the directory structure "News/cache/nnml:left/right/1" is
> created.
>
> The "." in the active file comes from `gnus-cache-generate-active`, and
> that mechanism seems to be working fine, at least in my case -- do you
> not see that version of the group?
>
> To be honest I have no idea what's happening in `gnus-cache-file-name'.
> I'd be hesitant to remove all that code without understanding it better
> And I don't think we can argue that that code is "dead" just because it
> is behind an option value that isn't one of the customization options.
>
> Anyway, it would be good to first know why you're not seeing the "."
> version of the offending filename, and then I guess try to work out
> what's going on with the file names. It kind of looks like a collision
> between two different mechanisms -- one that translates "/" to "_" to
> prevent unwanted filesystem hierarchies, and one that translates between
> "/" and "." in order to convert newsgroup-name dot hierarchies into
> filesystem hierarchies. In this case, it seems like "long names" and
> newsgroup hierarchies shouldn't be applicable at all.

I was briefly optimistic about the possibility that your previous patch,
on bug#65467, might help address this issue. That patch did make it
possible for nnml groups with slashes in the name to work correctly
(they didn't, previously), but it still doesn't address this particular
scenario.

Meanwhile, I realize that my hesitation on that bug report is bogus, as
everywhere else we already have active files with quotes in them, and
`gnus-active-to-gnus-format' does a fair amount of work to handle
various quoting situations.

The real problem (well, one of the real problems) is that we should just
have two central routines for reading and writing active files, so that
there are only two places to keep in sync. Instead we have those two
places, and then a smattering of other functions in other places that do
something similar, and also have to be kept in sync, and I haven't done
that. At the very least I'll need to apply your patch from 65467.

The other real problem is that gnus-cache is confused about whether it
wants to be a select method, or a modified version of article saving.
The presence of `gnus-use-long-file-name' indicates the latter, but the
manual's instructions about the nnml select method indicates the former.

I think it should be a select method, which means that the group
directory should be created in "News/cache" the same way it is created
at the top level: with the "/" replaced by "_", and everything else
using the proper "left/right" group name. Perhaps "long file names" can
still play a role, but if so that should be via
`nnmail-use-long-file-names', and gnus-cache in general should behave
like a nnmail backend.

Eric







Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69517; Package emacs. (Sun, 10 Mar 2024 21:33:02 GMT) Full text and rfc822 format available.

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

From: James Thomas <jimjoe <at> gmx.net>
To: 69517 <at> debbugs.gnu.org
Cc: Eric Abrahamsen <eric <at> ericabrahamsen.net>, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#69517: [PATCH] Make gnus cache work with group names having
 '/'
Date: Mon, 11 Mar 2024 03:02:01 +0530
(This is an interim untested opinion before I can backup my existing
messages and verify it...)

Eric Abrahamsen wrote:

> Thanks for reporting this! Obviously something is wrong here, but I get
> different results from your reproduction recipe (I'm running master):
> when I create the cache nnml server and hit RET on it, I get:
>
> K      1: nnml:left.right
> K      1: nnml:left/right
>
> I am able to subscribe to both groups. When I return to the *Group*
> buffer, I can enter the version of the group with the ".", and read the
> cached article, while attempting to enter the version with the slash
> gives me "Invalid group (no such directory)".
>
> On disk, the "News/cache/active" file starts out with the version with
> the ".", and after I create the extra cache server it contains both, it
> looks like:
>
> "nnml:left.right" 1 1 y
> "nnml:left/right" 1 1 y
>
> Meanwhile, the directory structure "News/cache/nnml:left/right/1" is
> created.
>
> The "." in the active file comes from `gnus-cache-generate-active`, and
> that mechanism seems to be working fine, at least in my case -- do you
> not see that version of the group?

`gnus-cache-generate-active` seems to be run if the active file doesn't
exist already (i.e. at the very start when creating a server): I was
adding new groups to an existing server. If my guess is right, that
first line with the dot being generated is a way of reversing the
earlier 'dot -> slash' when turning a group into a directory name. That
should be fixed as well if group names with slash have to be supported.

> while attempting to enter the version with the slash gives me "Invalid
> group (no such directory)".

Could you try entering it with this patch applied?

>
> To be honest I have no idea what's happening in `gnus-cache-file-name'.
> I'd be hesitant to remove all that code without understanding it better
> And I don't think we can argue that that code is "dead" just because it
> is behind an option value that isn't one of the customization options.
>
> Anyway, it would be good to first know why you're not seeing the "."
> version of the offending filename, and then I guess try to work out
> what's going on with the file names. It kind of looks like a collision
> between two different mechanisms -- one that translates "/" to "_" to
> prevent unwanted filesystem hierarchies, and one that translates between
> "/" and "." in order to convert newsgroup-name dot hierarchies into
> filesystem hierarchies. In this case, it seems like "long names" and
> newsgroup hierarchies shouldn't be applicable at all.

I think if the original group name contains dots, that should be part of
the hierarchy. But not slashes.

> The other real problem is that gnus-cache is confused about whether it
> wants to be a select method, or a modified version of article saving.
> The presence of `gnus-use-long-file-name' indicates the latter, but
> the manual's instructions about the nnml select method indicates the
> former.

Hmm..

> I think it should be a select method, which means that the group
> directory should be created in "News/cache" the same way it is created
> at the top level: with the "/" replaced by "_", and everything else
> using the proper "left/right" group name. Perhaps "long file names"
> can still play a role, but if so that should be via
> `nnmail-use-long-file-names', and gnus-cache in general should behave
> like a nnmail backend.

I think this patch is on those lines, isn't it?

Regards,
James




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69517; Package emacs. (Thu, 14 Mar 2024 03:28:01 GMT) Full text and rfc822 format available.

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

From: James Thomas <jimjoe <at> gmx.net>
To: 69517 <at> debbugs.gnu.org
Cc: Eric Abrahamsen <eric <at> ericabrahamsen.net>, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#69517: [PATCH] Make gnus cache work with group names having
 '/'
Date: Thu, 14 Mar 2024 08:56:08 +0530
[Message part 1 (text/plain, inline)]
Eric Abrahamsen wrote:

> The real problem (well, one of the real problems) is that we should just
> have two central routines for reading and writing active files, so that
> there are only two places to keep in sync. Instead we have those two
> places, and then a smattering of other functions in other places that do
> something similar, and also have to be kept in sync, and I haven't done
> that. At the very least I'll need to apply your patch from 65467.
>
> The other real problem is that gnus-cache is confused about whether it
> wants to be a select method, or a modified version of article saving.
> The presence of `gnus-use-long-file-name' indicates the latter, but the
> manual's instructions about the nnml select method indicates the former.
>
> I think it should be a select method, which means that the group
> directory should be created in "News/cache" the same way it is created
> at the top level: with the "/" replaced by "_", and everything else
> using the proper "left/right" group name. Perhaps "long file names" can
> still play a role, but if so that should be via
> `nnmail-use-long-file-names', and gnus-cache in general should behave
> like a nnmail backend.

Well, I have sort of, an approach based on my earlier patch:

[0001-Make-gnus-cache-work-with-group-names-having.patch (text/x-diff, attachment)]
[Message part 3 (text/plain, inline)]
James Thomas wrote:

> +	(if (not nnmail-use-long-file-names)
> +            (nnheader-replace-chars-in-string group ?. ?/)
> +	  group))

Since directory names cannot have '/' they used to be replaced by '_' in
group names before conversion. But this makes it impossible, when
generating (non-existent) active files to know whether a '_' in the
directory name was _ or / originally.

The above patch tries a possible solution inspired from [1] but would
break existing users of the cache or agent (xref-find-references
"nnmail-group-pathname") who have groups with % or / in their names.

Seems to work in my limited testing. WDYT?

Regards,
James

1:
https://stackoverflow.com/questions/9847288/is-it-possible-to-use-in-a-filename#answer-9847319

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69517; Package emacs. (Fri, 15 Mar 2024 17:35:02 GMT) Full text and rfc822 format available.

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

From: Daniel Semyonov <daniel <at> dsemy.com>
To: James Thomas <jimjoe <at> gmx.net>
Cc: Eric Abrahamsen <eric <at> ericabrahamsen.net>, Eli Zaretskii <eliz <at> gnu.org>,
 69517 <at> debbugs.gnu.org
Subject: Re: bug#69517: [PATCH] Make gnus cache work with group names having
 '/'
Date: Fri, 15 Mar 2024 19:33:42 +0200
>>>>> James Thomas writes:

    > Eric Abrahamsen wrote:
    >> The real problem (well, one of the real problems) is that we should just
    >> have two central routines for reading and writing active files, so that
    >> there are only two places to keep in sync. Instead we have those two
    >> places, and then a smattering of other functions in other places that do
    >> something similar, and also have to be kept in sync, and I haven't done
    >> that. At the very least I'll need to apply your patch from 65467.
    >> 
    >> The other real problem is that gnus-cache is confused about whether it
    >> wants to be a select method, or a modified version of article saving.
    >> The presence of `gnus-use-long-file-name' indicates the latter, but the
    >> manual's instructions about the nnml select method indicates the former.
    >> 
    >> I think it should be a select method, which means that the group
    >> directory should be created in "News/cache" the same way it is created
    >> at the top level: with the "/" replaced by "_", and everything else
    >> using the proper "left/right" group name. Perhaps "long file names" can
    >> still play a role, but if so that should be via
    >> `nnmail-use-long-file-names', and gnus-cache in general should behave
    >> like a nnmail backend.

    > Well, I have sort of, an approach based on my earlier patch: [patch]

    > James Thomas wrote:

    >> +	(if (not nnmail-use-long-file-names)
    >> +            (nnheader-replace-chars-in-string group ?. ?/)
    >> +	  group))

    > Since directory names cannot have '/' they used to be replaced by '_' in
    > group names before conversion. But this makes it impossible, when
    > generating (non-existent) active files to know whether a '_' in the
    > directory name was _ or / originally.

    > The above patch tries a possible solution inspired from [1] but would
    > break existing users of the cache or agent (xref-find-references
    > "nnmail-group-pathname") who have groups with % or / in their names.

    > Seems to work in my limited testing. WDYT?

I tested it and it seems to work, but I'm pretty sure it will also break
existing groups with % or / in their names in several backends.
For example, the `nnmh' and `nndiary' backends use this function to
locate groups on disk, which will fail for those groups (unless users
rename the files manually).

FWIW I think this approach is good, but since Gnus doesn't even emit a
warning currently when creating a group with % in its name, I don't
think breaking these groups is a good idea.

Daniel




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69517; Package emacs. (Sat, 16 Mar 2024 00:24:01 GMT) Full text and rfc822 format available.

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

From: James Thomas <jimjoe <at> gmx.net>
To: Daniel Semyonov <daniel <at> dsemy.com>
Cc: Eric Abrahamsen <eric <at> ericabrahamsen.net>, Eli Zaretskii <eliz <at> gnu.org>,
 69517 <at> debbugs.gnu.org
Subject: Re: bug#69517: [PATCH] Make gnus cache work with group names having
 '/'
Date: Sat, 16 Mar 2024 05:52:30 +0530
Daniel Semyonov wrote:

>>>>>> James Thomas writes:
>
>     > James Thomas wrote:
>
>     >> +	(if (not nnmail-use-long-file-names)
>     >> +            (nnheader-replace-chars-in-string group ?. ?/)
>     >> +	  group))
>
>     > Since directory names cannot have '/' they used to be replaced by '_' in
>     > group names before conversion. But this makes it impossible, when
>     > generating (non-existent) active files to know whether a '_' in the
>     > directory name was _ or / originally.
>
>     > The above patch tries a possible solution inspired from [1] but would
>     > break existing users of the cache or agent (xref-find-references
>     > "nnmail-group-pathname") who have groups with % or / in their names.
>
>     > Seems to work in my limited testing. WDYT?
>
> I tested it and it seems to work, but I'm pretty sure it will also break
> existing groups with % or / in their names in several backends.
> For example, the `nnmh' and `nndiary' backends use this function to
> locate groups on disk, which will fail for those groups (unless users
> rename the files manually).

I think only one of these combinations is likely to be a problem in
practice: groups such as [Gmail]/Drafts. I've never seen a % in a group
name. The cache wouldn't work for one with / anyway (this bug) and as
far as the agent is concerned, none of the Gmail groups with spaces in
them work anyway (bug#65467: note that the patch on this is also needed
for the agent to work on these groups with /). I haven't used nnmh or
nndiary but I don't think they normally use group names with '/'.

Regards,
James




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69517; Package emacs. (Thu, 28 Mar 2024 09:43:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Daniel Semyonov <daniel <at> dsemy.com>
Cc: eric <at> ericabrahamsen.net, 69517 <at> debbugs.gnu.org, jimjoe <at> gmx.net
Subject: Re: bug#69517: [PATCH] Make gnus cache work with group names having
 '/'
Date: Thu, 28 Mar 2024 11:42:00 +0200
Ping! Is there anything else left to be done here, or should we close
this?

> From: Daniel Semyonov <daniel <at> dsemy.com>
> Cc: 69517 <at> debbugs.gnu.org,  Eric Abrahamsen <eric <at> ericabrahamsen.net>,  Eli
>  Zaretskii <eliz <at> gnu.org>
> Date: Fri, 15 Mar 2024 19:33:42 +0200
> 
> >>>>> James Thomas writes:
> 
>     > Eric Abrahamsen wrote:
>     >> The real problem (well, one of the real problems) is that we should just
>     >> have two central routines for reading and writing active files, so that
>     >> there are only two places to keep in sync. Instead we have those two
>     >> places, and then a smattering of other functions in other places that do
>     >> something similar, and also have to be kept in sync, and I haven't done
>     >> that. At the very least I'll need to apply your patch from 65467.
>     >> 
>     >> The other real problem is that gnus-cache is confused about whether it
>     >> wants to be a select method, or a modified version of article saving.
>     >> The presence of `gnus-use-long-file-name' indicates the latter, but the
>     >> manual's instructions about the nnml select method indicates the former.
>     >> 
>     >> I think it should be a select method, which means that the group
>     >> directory should be created in "News/cache" the same way it is created
>     >> at the top level: with the "/" replaced by "_", and everything else
>     >> using the proper "left/right" group name. Perhaps "long file names" can
>     >> still play a role, but if so that should be via
>     >> `nnmail-use-long-file-names', and gnus-cache in general should behave
>     >> like a nnmail backend.
> 
>     > Well, I have sort of, an approach based on my earlier patch: [patch]
> 
>     > James Thomas wrote:
> 
>     >> +	(if (not nnmail-use-long-file-names)
>     >> +            (nnheader-replace-chars-in-string group ?. ?/)
>     >> +	  group))
> 
>     > Since directory names cannot have '/' they used to be replaced by '_' in
>     > group names before conversion. But this makes it impossible, when
>     > generating (non-existent) active files to know whether a '_' in the
>     > directory name was _ or / originally.
> 
>     > The above patch tries a possible solution inspired from [1] but would
>     > break existing users of the cache or agent (xref-find-references
>     > "nnmail-group-pathname") who have groups with % or / in their names.
> 
>     > Seems to work in my limited testing. WDYT?
> 
> I tested it and it seems to work, but I'm pretty sure it will also break
> existing groups with % or / in their names in several backends.
> For example, the `nnmh' and `nndiary' backends use this function to
> locate groups on disk, which will fail for those groups (unless users
> rename the files manually).
> 
> FWIW I think this approach is good, but since Gnus doesn't even emit a
> warning currently when creating a group with % in its name, I don't
> think breaking these groups is a good idea.
> 
> Daniel
> 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69517; Package emacs. (Fri, 29 Mar 2024 00:11:01 GMT) Full text and rfc822 format available.

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

From: James Thomas <jimjoe <at> gmx.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: eric <at> ericabrahamsen.net, Daniel Semyonov <daniel <at> dsemy.com>,
 69517 <at> debbugs.gnu.org
Subject: Re: bug#69517: [PATCH] Make gnus cache work with group names having
 '/'
Date: Fri, 29 Mar 2024 05:39:50 +0530
Eli Zaretskii wrote:

> Ping! Is there anything else left to be done here, or should we close
> this?
>
>> From: Daniel Semyonov <daniel <at> dsemy.com>
>> Cc: 69517 <at> debbugs.gnu.org,  Eric Abrahamsen <eric <at> ericabrahamsen.net>,  Eli
>>  Zaretskii <eliz <at> gnu.org>
>> Date: Fri, 15 Mar 2024 19:33:42 +0200
>>
>> >>>>> James Thomas writes:
>>
>>     > Eric Abrahamsen wrote:
>>     >> The real problem (well, one of the real problems) is that we should just
>>     >> have two central routines for reading and writing active files, so that
>>     >> there are only two places to keep in sync. Instead we have those two
>>     >> places, and then a smattering of other functions in other places that do
>>     >> something similar, and also have to be kept in sync, and I haven't done
>>     >> that. At the very least I'll need to apply your patch from 65467.
>>     >>
>>     >> The other real problem is that gnus-cache is confused about whether it
>>     >> wants to be a select method, or a modified version of article saving.
>>     >> The presence of `gnus-use-long-file-name' indicates the latter, but the
>>     >> manual's instructions about the nnml select method indicates the former.
>>     >>
>>     >> I think it should be a select method, which means that the group
>>     >> directory should be created in "News/cache" the same way it is created
>>     >> at the top level: with the "/" replaced by "_", and everything else
>>     >> using the proper "left/right" group name. Perhaps "long file names" can
>>     >> still play a role, but if so that should be via
>>     >> `nnmail-use-long-file-names', and gnus-cache in general should behave
>>     >> like a nnmail backend.
>>
>>     > Well, I have sort of, an approach based on my earlier patch: [patch]
>>
>>     > James Thomas wrote:
>>
>>     >> +	(if (not nnmail-use-long-file-names)
>>     >> +            (nnheader-replace-chars-in-string group ?. ?/)
>>     >> +	  group))
>>
>>     > Since directory names cannot have '/' they used to be replaced by '_' in
>>     > group names before conversion. But this makes it impossible, when
>>     > generating (non-existent) active files to know whether a '_' in the
>>     > directory name was _ or / originally.
>>
>>     > The above patch tries a possible solution inspired from [1] but would
>>     > break existing users of the cache or agent (xref-find-references
>>     > "nnmail-group-pathname") who have groups with % or / in their names.
>>
>>     > Seems to work in my limited testing. WDYT?
>>
>> I tested it and it seems to work, but I'm pretty sure it will also break
>> existing groups with % or / in their names in several backends.
>> For example, the `nnmh' and `nndiary' backends use this function to
>> locate groups on disk, which will fail for those groups (unless users
>> rename the files manually).
>>
>> FWIW I think this approach is good, but since Gnus doesn't even emit a
>> warning currently when creating a group with % in its name, I don't
>> think breaking these groups is a good idea.
>>
>> Daniel
>>

I've been using this since then, on master, with no problems. Let me add
to my earlier reasons for being confident about this not breaking
existing setups:

James Thomas wrote:

> I think only one of these combinations is likely to be a problem in
> practice: groups such as [Gmail]/Drafts. I've never seen a % in a
> group name. The cache wouldn't work for one with / anyway (this bug)
> and as far as the agent is concerned, none of the Gmail groups with
> spaces in them work anyway (bug#65467: note that the patch on this is
> also needed for the agent to work on these groups with /). I haven't
> used nnmh or nndiary but I don't think they normally use group names
> with '/'.

The only ones with '/' (and no spaces) I know of are the Gmail groups,
namely:

[Gmail]/Bin
[Gmail]/Drafts
[Gmail]/Important
[Gmail]/Spam
[Gmail]/Starred

...which are unlikely to be agentized because of their nature (though
ideally the patch at bug#65467 ought to be applied as well, after this).

Moreover, getting Gmail to work with Gnus requires a paid account and a
complicated setup with OAuth2 (AFAIK, because I use one) which only few
people are likely to have managed.

Lastly, the fix for such an unlikely existing setup is a simple rename
of the directory: say, from [Gmail]_Drafts to [Gmail]%2FDrafts.

Regards,
James




Reply sent to Eric Abrahamsen <eric <at> ericabrahamsen.net>:
You have taken responsibility. (Sat, 30 Mar 2024 22:22:02 GMT) Full text and rfc822 format available.

Notification sent to James Thomas <jimjoe <at> gmx.net>:
bug acknowledged by developer. (Sat, 30 Mar 2024 22:22:02 GMT) Full text and rfc822 format available.

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

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: James Thomas <jimjoe <at> gmx.net>
Cc: 69517-done <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Daniel Semyonov <daniel <at> dsemy.com>
Subject: Re: bug#69517: [PATCH] Make gnus cache work with group names having
 '/'
Date: Sat, 30 Mar 2024 15:21:01 -0700
On 03/29/24 05:39 AM, James Thomas wrote:
> Eli Zaretskii wrote:
>
>> Ping! Is there anything else left to be done here, or should we close
>> this?
>>
>>> From: Daniel Semyonov <daniel <at> dsemy.com>
>>> Cc: 69517 <at> debbugs.gnu.org,  Eric Abrahamsen <eric <at> ericabrahamsen.net>,  Eli
>>>  Zaretskii <eliz <at> gnu.org>
>>> Date: Fri, 15 Mar 2024 19:33:42 +0200
>>>
>>> >>>>> James Thomas writes:
>>>
>>>     > Eric Abrahamsen wrote:
>>>     >> The real problem (well, one of the real problems) is that we should just
>>>     >> have two central routines for reading and writing active files, so that
>>>     >> there are only two places to keep in sync. Instead we have those two
>>>     >> places, and then a smattering of other functions in other places that do
>>>     >> something similar, and also have to be kept in sync, and I haven't done
>>>     >> that. At the very least I'll need to apply your patch from 65467.
>>>     >>
>>>     >> The other real problem is that gnus-cache is confused about whether it
>>>     >> wants to be a select method, or a modified version of article saving.
>>>     >> The presence of `gnus-use-long-file-name' indicates the latter, but the
>>>     >> manual's instructions about the nnml select method indicates the former.
>>>     >>
>>>     >> I think it should be a select method, which means that the group
>>>     >> directory should be created in "News/cache" the same way it is created
>>>     >> at the top level: with the "/" replaced by "_", and everything else
>>>     >> using the proper "left/right" group name. Perhaps "long file names" can
>>>     >> still play a role, but if so that should be via
>>>     >> `nnmail-use-long-file-names', and gnus-cache in general should behave
>>>     >> like a nnmail backend.
>>>
>>>     > Well, I have sort of, an approach based on my earlier patch: [patch]
>>>
>>>     > James Thomas wrote:
>>>
>>>     >> +	(if (not nnmail-use-long-file-names)
>>>     >> +            (nnheader-replace-chars-in-string group ?. ?/)
>>>     >> +	  group))
>>>
>>>     > Since directory names cannot have '/' they used to be replaced by '_' in
>>>     > group names before conversion. But this makes it impossible, when
>>>     > generating (non-existent) active files to know whether a '_' in the
>>>     > directory name was _ or / originally.
>>>
>>>     > The above patch tries a possible solution inspired from [1] but would
>>>     > break existing users of the cache or agent (xref-find-references
>>>     > "nnmail-group-pathname") who have groups with % or / in their names.
>>>
>>>     > Seems to work in my limited testing. WDYT?
>>>
>>> I tested it and it seems to work, but I'm pretty sure it will also break
>>> existing groups with % or / in their names in several backends.
>>> For example, the `nnmh' and `nndiary' backends use this function to
>>> locate groups on disk, which will fail for those groups (unless users
>>> rename the files manually).
>>>
>>> FWIW I think this approach is good, but since Gnus doesn't even emit a
>>> warning currently when creating a group with % in its name, I don't
>>> think breaking these groups is a good idea.
>>>
>>> Daniel
>>>
>
> I've been using this since then, on master, with no problems. Let me add
> to my earlier reasons for being confident about this not breaking
> existing setups:
>
> James Thomas wrote:
>
>> I think only one of these combinations is likely to be a problem in
>> practice: groups such as [Gmail]/Drafts. I've never seen a % in a
>> group name. The cache wouldn't work for one with / anyway (this bug)
>> and as far as the agent is concerned, none of the Gmail groups with
>> spaces in them work anyway (bug#65467: note that the patch on this is
>> also needed for the agent to work on these groups with /). I haven't
>> used nnmh or nndiary but I don't think they normally use group names
>> with '/'.
>
> The only ones with '/' (and no spaces) I know of are the Gmail groups,
> namely:
>
> [Gmail]/Bin
> [Gmail]/Drafts
> [Gmail]/Important
> [Gmail]/Spam
> [Gmail]/Starred
>
> ...which are unlikely to be agentized because of their nature (though
> ideally the patch at bug#65467 ought to be applied as well, after this).
>
> Moreover, getting Gmail to work with Gnus requires a paid account and a
> complicated setup with OAuth2 (AFAIK, because I use one) which only few
> people are likely to have managed.
>
> Lastly, the fix for such an unlikely existing setup is a simple rename
> of the directory: say, from [Gmail]_Drafts to [Gmail]%2FDrafts.

Thanks, I've now applied this, and am closing the bug. Sorry this took
so long -- I kept thinking I would dive a little deeper into the nnmail
file/directory shenanigans and get a better grasp on the internals, but
obviously was not finding the time. In it goes!

Eric




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

This bug report was last modified 5 days ago.

Previous Next


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