From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#69517: [PATCH] Make gnus cache work with group names having '/' Date: Sat, 30 Mar 2024 15:21:01 -0700 Message-ID: <87jzlj5pki.fsf@ericabrahamsen.net> References: <87wmqkcc9u.fsf@outlook.com> <86wmqbyews.fsf@gnu.org> <8734szul14.fsf@gmx.net> <874jde7j2c.fsf@ericabrahamsen.net> <87v85u5448.fsf@ericabrahamsen.net> <8734sttrxr.fsf@gmx.net> <87zfuzcscp.fsf@dsemy.com> <86h6gqhevr.fsf@gnu.org> <87y1a199v5.fsf@gmx.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4951"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 69517-done@debbugs.gnu.org, Eli Zaretskii , Daniel Semyonov To: James Thomas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 30 23:22:30 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rqh5p-00014y-85 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Mar 2024 23:22:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rqh5O-0002Gd-Dz; Sat, 30 Mar 2024 18:22:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rqh5M-0002Fs-Pn for bug-gnu-emacs@gnu.org; Sat, 30 Mar 2024 18:22:00 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rqh5M-00030P-FH for bug-gnu-emacs@gnu.org; Sat, 30 Mar 2024 18:22:00 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rqh5O-0002Hj-J2 for bug-gnu-emacs@gnu.org; Sat, 30 Mar 2024 18:22:02 -0400 Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Mar 2024 22:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 69517 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Mail-Followup-To: 69517@debbugs.gnu.org, eric@ericabrahamsen.net, jimjoe@gmx.net Original-Received: via spool by 69517-done@debbugs.gnu.org id=D69517.17118372758662 (code D ref 69517); Sat, 30 Mar 2024 22:22:02 +0000 Original-Received: (at 69517-done) by debbugs.gnu.org; 30 Mar 2024 22:21:15 +0000 Original-Received: from localhost ([127.0.0.1]:46282 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rqh4c-0002Fd-SH for submit@debbugs.gnu.org; Sat, 30 Mar 2024 18:21:15 -0400 Original-Received: from mail.ericabrahamsen.net ([52.70.2.18]:36052) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rqh4Z-0002F4-Ja for 69517-done@debbugs.gnu.org; Sat, 30 Mar 2024 18:21:14 -0400 Original-Received: from localhost (71-212-21-65.tukw.qwest.net [71.212.21.65]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 01D60FA059; Sat, 30 Mar 2024 22:21:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericabrahamsen.net; s=mail; t=1711837263; bh=vmqDK03X6Mq2bX/+Lh9RbiMQZabyliddTJk8ayfvb70=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=TdUQBtVla4FZRe9p6XGdTZxuFUNdLfFhM0ITYZkua21SCvmAY+px3k4UNnt+zxcQ9 BCd/l55VNevKCU+jTNUpKlS7pT5iuHyxbEwbHSjfWBT47Ph0YwmxDxVYmGawAFgCrU yrGBvcHER+PhdPgWSCUNVv9UGDK1i/+VFXGDE4Jw= In-Reply-To: <87y1a199v5.fsf@gmx.net> (James Thomas's message of "Fri, 29 Mar 2024 05:39:50 +0530") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:282401 Archived-At: 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 >>> Cc: 69517@debbugs.gnu.org, Eric Abrahamsen , Eli >>> Zaretskii >>> 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