GNU bug report logs - #73581
29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep

Previous Next

Packages: gnus, emacs;

Reported by: Daniel Cerqueira <dan.list <at> lispclub.com>

Date: Tue, 1 Oct 2024 15:55:02 UTC

Severity: normal

Found in version 29.4

Full log


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

From: Daniel Cerqueira <dan.list <at> lispclub.com>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: 73581 <at> debbugs.gnu.org
Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with
 gnus-search-find-grep
Date: Sat, 12 Apr 2025 12:38:27 +0100
[Message part 1 (text/plain, inline)]
Visuwesh <visuweshm <at> gmail.com> writes:

> [சனி ஏப்ரல் 12, 2025] Daniel Cerqueira wrote:
>
>> Visuwesh <visuweshm <at> gmail.com> writes:
>>
>>> [வெள்ளி ஏப்ரல் 11, 2025] Daniel Cerqueira wrote:
>>>
>>>> A bit related:
>>>>
>>>> Can you give an overview how to make search queries with find-grep?
>>>>
>>>> For example, I am trying to make a query with "grep:"happy birthday"
>>>> subject:friend" and it is not working.  Should I prepend a "grep:" after
>>>> each space (on the search keywords)?
>>>
>>> AFAIU the code, you can't have space in the grep part.  See how
>>> gnus-search parses these "meta keywords" in gnus-search-prepare-query.
>>> Having two grep: selects the last one.  Give the patch below a try, I
>>> don't think it is a good idea to reuse gnus-search-query-next-expr since
>>> it does more than just go over "":
>>>
>>> diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el
>>> index 41915a0e3c0..7ca67e2134b 100644
>>> --- a/lisp/gnus/gnus-search.el
>>> +++ b/lisp/gnus/gnus-search.el
>>> @@ -2110,20 +2140,28 @@ gnus-search-prepare-query
>>
>> [...]
>>
>> The patch did not work.  I haven't recorded the message error, but it
>> was something to do with the something-generate-artlist having the wrong
>> number of arguments.
>>
>> You don't need to fix it, if you don't want to, have too much work, or
>> don't have time.
>
> I can give a shot at debugging, when I have time, if you provide the
> backtrace.  Getting the find-grep backend to work was a goal for me, you
> gave me a good excuse to procrastinate from working on my thesis.  ;-)

Ahaha!  Now it is giving no error.  But it is also not resulting a
result (from a search query that I know it has matches).

The message that I get is:

Group nnselect:nnselect-87tt6taade.fsf contains no messages

I also have changed this variable:

(set 'gnus-search-default-engines
      '((nnimap . gnus-search-imap)
        (nnmaildir . gnus-search-find-grep)
        (nnselect . gnus-search-nnselect)
        ;; (nnselect . gnus-search-find-grep)
        ))

Maybe this variable is incorrect?  What I want is for the nnmaildir
back-end to use find-grep.

Also, in listing all buffers, I have this variable (which comes from
doing a search): "*gnus-search-" .  It seems to be missing a name in the
end, and also an "*".


>>>> How to search in the subject or by date?
>>>
>>> You can't, the find-grep search backend simply runs grep.  If you don't
>>> want to use mu or notmuch, you could try writing a backend for mblaze.
>>
>> Okay.  Regarding subject, I understand grep not doing it; but regarding
>> time, something can be done with find (it is find-grep after all).  No
>> need or no pressure in doing it, though.
>
> I don't think we can exploit the various time statistics attached with a
> file to achieve what you want.  A message from 2019 reports:
>
>     % stat ~/mail/XXX/inbox/cur/1641645812.328064_1.astatine,U=1:2,S
>       File: ~/mail/XXX/inbox/cur/1641645812.328064_1.astatine,U=1:2,S
>       Size: 8420      	Blocks: 24         IO Block: 4096   regular file
>     Device: 8,4	Inode: 5774494     Links: 1
>     Access: (0600/-rw-------)  Uid: ( 1000/     viz)   Gid: ( 1000/     viz)
>     Access: 2025-04-12 13:46:05.575388637 +0530
>     Modify: 2022-01-08 18:13:32.297967005 +0530
>     Change: 2022-06-05 07:44:16.919565297 +0530
>      Birth: 2022-01-08 18:13:32.297967005 +0530
>    % grep ^Date: ~/mail/XXX/inbox/cur/1641645812.328064_1.astatine,U=1:2,S
>    Date: Mon, 21 Jan 2019 02:14:48 -0800

What I was thinking is using the arguments of the executable find, such
as atime, ctime, mtime (which one fits best?), when using a query for
time, such as since:3d (I believe the keyword for other queries is
"since:", but I am not sure of this).

> My first impressions of mblaze tells me writing a gnus-search backend
> for it is going to be a formidable task since there's no easy way to
> compose multi-header queries (we can use mpick but I don't think it can
> act on message body text).

I am not willing to install more executables on my system.  That is why
I am wanting to use find-grep.
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 66 days ago.

Previous Next


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