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: Mon, 13 May 2024 17:55:38 -0700

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

> Hello Eric, thanks for looking into it once again.
>
> "Eric Abrahamsen" <[email-masked]> writes:
>
>> So it looks like there's multiple things going on here. First of all,
>> the check for bogus groups explicitly excludes secondary select methods.
>> Why I do not know, but it's been that way since 2004.
>
> I believe that this is a bug. The documentation says that the `bogus'
> group is such that exists in the `.newsrc' file, but isn’t known to the
> server (i.e., it isn’t in the active file).
>
> So it must not be active and must not be foreign. But the definition of
> foreign group in `gnus-check-bogus-newsgroups' is different from what
> was defined by Lars in 1997:
>
> (defun gnus-group-foreign-p (group)
>   "Say whether a group is foreign or not."
>   (and (not (gnus-group-native-p group))
>        (not (gnus-group-secondary-p group))))
>
> We should use this predicate in `gnus-check-bogus-newsgroups' which
> fixes the bug we hit along the way (different behaviour between primary
> (native) and secondary select methods).
>
> What do you think?

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.

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.

Your patch (or at least the understanding behind it) should be part of
the fix, but there will have to be more.

Thanks,
Eric