GNU bug report logs - #66885
29.1; gnus search with mu always returns empty

Previous Next

Package: emacs;

Reported by: Britt Anderson <britt <at> b3l.xyz>

Date: Wed, 1 Nov 2023 16:04:01 UTC

Severity: normal

Found in version 29.1

Done: Eric Abrahamsen <eric <at> ericabrahamsen.net>

Bug is archived. No further changes may be made.

Full log


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

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: Britt Anderson <britt <at> uwaterloo.ca>
Cc: Britt Anderson <britt <at> b3l.xyz>,
 "66885 <at> debbugs.gnu.org" <66885 <at> debbugs.gnu.org>
Subject: Re: bug#66885: 29.1; gnus search with mu always returns empty
Date: Sun, 31 Dec 2023 18:53:28 -0800
Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:

> Britt Anderson <britt <at> uwaterloo.ca> writes:
>
>> Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:
>>
>>> Your configuration looks correct (your configuration also reveals an
>>> annoying redundancy in gnus-search, which is that most nnmail
>>> backends have a "directory" value that can and should be used as the
>>> value of remove-prefix).
>>>
>>> Basically, if you're seeing "a maildir "y2023" that lives in archives"
>>> as a Gnus group, then this is just a bug in gnus-search's mu handling,
>>> plain and simple.
>>
>> I think the bug starts on line 1952 of gnus-search.el.gz (when opened in
>> emacs). It is in the definition of the method for
>
> (Thank you for continuing to bug-hunt, this looks promising, I've just
> gotten back from traveling and will set this up to test soon...)

Hi Britt, I'm finally getting around to testing this. I set up mu with a
local maildir, and so far I'm not able to reproduce the problem. I mark
two maildir groups and search for unread messages with "mark:unread".

The search arguments constructed by gnus-search look like:

("find" "--nocolor" "--muhome=/home/eric/.cache/mu" "" "" "flag:unread"
"and" "(" "maildir:/mails" "or" "maildir:/Welcome" ")" "--format=plain"
"--fields=l")

Putting that on the command line and running it gives 17 results, and I
see the same 17 results within the Gnus search buffer. With the search
engine's `remove-prefix` set to the full system file path up to the main
directory of the nnmaildir backend (under which the groups appear as
top-level directories) the results are shown correctly within Gnus.

The group handling code you noticed is necessary, the
`(concat "maildir:/" x)` code is mu-specific.

I'm not sure what else to try! Even if mu is returning results from
other Gnus backends, that shouldn't cause a failure. Though mu has the
"path:" key we can use with remove-prefix...

The last things to try would be: setting `gnus-verbose' to 10, trying
the search, and telling me what you find in *Message*, and...

eval'ing this version of the mu command method, that includes the
"path:" key. Does this fix the problem?

(cl-defmethod gnus-search-indexed-search-command ((engine gnus-search-mu)
						  (qstring string)
						  query &optional groups)
  (let ((limit (alist-get 'limit query))
	(thread (alist-get 'thread query)))
    (with-slots (switches config-directory remove-prefix) engine
      `("find" 			; command must come first
	"--nocolor"		; mu will always give colored output otherwise
	,(format "--muhome=%s" config-directory)
	,@switches
	,(if thread "-r" "")
	,(if limit (format "--maxnum=%d" limit) "")
	,qstring
	,@(if groups
	      `("and" "("
		,@(nbutlast (mapcan (lambda (x)
				      (list (concat "maildir:/" x) "or"))
				    groups))
		")")
	    "")
	,(format "path:%s" (file-name-as-directory
                    (expand-file-name remove-prefix "/")))
	"--format=plain"
	"--fields=l"))))




This bug report was last modified 1 year and 218 days ago.

Previous Next


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