Subject: Re: bug#45770: 28.0.50; `gnus-search-run-search' for imap does not take parentheses into account

From: Eric Abrahamsen <[email-masked]>
Date: Sun, 10 Jan 2021 10:36:01 -0800

Michael Welsh Duggan <[email-masked]> writes:

> When using the `gnus-search-imap' backend for `gnus-search', there is a
> bug in the `gnus-search-run-search' method.  When the search query
> begins with parentheses (such as "(OR FROM A FROM B)"), the naive check
> for a known IMAP keyword at the beginning fails due to the parenthesis,
> and gnus-search adds "TEXT " to the beginning of the query.

Thanks for the report. This is a known problem, one which I actually
thought I'd already fixed! But apparently I wavered on whether the
TEXT-appending "convenience" was actually a convenience or not, and then
got distracted.

> Moreover, these are several search keys that are not in
> `gnus-search-imap-search-keys'.  These are "new", "not", "old", and
> "or".

Thanks for "new" and "old", I missed those somehow. I was thinking I'd
just check for "not" and "or" explicitly. Anyway, I'll get this fixed
later today.

> I include a minimal patch for these problems.
>
> There's another misfeature which I have not attempted to fix that made
> debugging the problem much more difficult.  If the result of a query is
> not OK, this fact just gets ignored by `gnus-search-run-search' and the
> search group is considered empty.  Even after fixing the above problems,
> this is a problem when doing a raw search, as one doesn't know whether
> the query is bad or if it just does not result in any messages.

This is another known problem, one that is requiring some coordination
with Andy Cohen on the nnselect backend (it's actually nnselect that is
swallowing the errors). This will get fixed before too long.

Thanks,
Eric