Subject: Re: bug#60078: 30.0.50; Gnus: Can't remove groups of select methods that don't exist anymore

From: Eric Abrahamsen <[email-masked]>
Date: Thu, 16 May 2024 10:02:51 -0700

Jakub Ječmínek via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <[email-masked]> writes:

> This whole issue sent me really deep, so thank you for sticking by.

It's pretty confusing.

> "Eric Abrahamsen" <[email-masked]> writes:
>
>> I think you're right about the definition of "foreign", and that there's
>> a bug/misunderstanding in code like this, but this check isn't a
>> complete fix because `gnus-group-secondary-p' looks up the group's
>> method, and the whole reason we're running this code is that the group's
>> method no longer exists. (The original/current code also has this
>> issue.) If the method is actually gone, groups that used to belong to it
>> will also be passed over.
>
> Then it comes down to you as package maintainer to decide what bogus
> group actually is, because current definition makes little sense to
> me. For example, if the server is down and Gnus is not able to get
> active info, all groups belonging to that server become bogus, which is
> a little unfortunate.
>
>> So I guess there's two scenarios to support: in the first, the server is
>> still there but one or more groups are gone (someone's deleted an IMAP
>> folder from the server) and in the second the server itself has been
>> removed from the user's config files, and we're clearing out the old
>> groups.
>
> Both of these cases can be handled with simple (group-active group)
> predicate. Do you have a clue why Lars wanted to handle foreign groups
> separately? I've searched (ding) mailing list, old bug reports,
> changelogs, commit messages, and everything else I could find but I
> found nothing.

This code is ancient, so I think we're dealing with both terminology and
functionality that has evolved over time. A bit of searching indicates
that "bogus" was something of a technical term (in the 90s) in the
usenet world, and meant a group that was being deprecated or deleted,
where server administrators were encouraged to drop it or at least stop
advertising its existence. I think in the Gnus context "bogus" very
specifically refers to this.

The 90s was also when Gnus was fundamentally a newsreader, with
"extras". The primary select method was always going to be a nntp
server. So this check may have grown extra functionality over the years,
but basically it was just meant to see if any NNTP groups had
disappeared from the server.

Now we have more types of server where this might be applicable:
disappearing IMAP folders, deleted maildir directories, etc.

This "foreign" thing is annoying. I guess it just means groups that are
created via the Gnus interface (ie "G m" etc) rather than in your config
files. But it's more subtle than that, because you don't create groups
via your config files, either, you only define select methods. And for
groups created via "G m", it's possible to create a group and specify an
existing (in-your-config-files) select method as its select method. And
if you specify a non-existent select method for the group, that select
method will be "created", in that now it will be treated as real, and
multiple groups that have the same sexp as their select methods will be
treated as having the "same" select method.

Where does that leave us? I think there's no safe way to say "this
group's select method no longer exists", because in many cases the
presence of a sexp like (nnml "<directory>") is enough to count as
"exists".

So I think "bogus" can only mean: "this group belongs to a server that
provides a `gnus-request-list' method, but when we request the list,
this group isn't in it".

I think you're right that simply checking if a group is active shouldn't
mean anything, as there are plenty of reasons a group might not be
activated.

WDYT?