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

From: Daniel Cerqueira <[email-masked]>
Date: Mon, 30 Sep 2024 16:44:26 +0100

Using Gnus, doing 'G G' on a nnmaildir group gives me this error:

```
nnselect-generate-artlist: gnus-search-run-query on ((search-query-spec (query . subject:meditation) (raw)) (search-group-spec (nnmaildir:email archive clients crypto-archive crypto-sent drafts inbox git git-l10n job-hunting list medical penpal poker sent shopping software spam wellness writing) (nndraft nndraft:delayed) (nndraft:nnmaildir:email nndraft:drafts))) gave error (wrong-type-argument stringp nil)
Group nnselect:nnselect-878qv99nf2.fsf contains no messages
```

The relevant configuration of `~/.emacs` is:

```
(setq message-kill-buffer-on-exit t) ;; C-c C-c kills the buffer
(setq gnus-check-bogus-newsgroups t) ;; delete bogus newsgroups at gnus startup

;;; open gnus in topics mode
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)

;;; lines with time
(setq gnus-summary-line-format "%U%R%z%I %4L %(%[%-25,25D %-23,23f%]%) %s
")

;;; order threads by most recent date
(setq gnus-thread-sort-functions '(gnus-thread-sort-by-most-recent-date))

;; hide summary lines of articles that have scores lower than this
(setq gnus-summary-expunge-below -9)

(setq gnus-select-method
      `(nnmaildir "email"
                  (directory ,(expand-file-name "~/.mail"))
                  (nnmaildir-directory ,(expand-file-name "~/.mail"))))

(setq gnus-message-archive-group '((if (message-news-p) "list" "sent")))
(setq nndraft-directory (expand-file-name "~/.mail/drafts"))

(setq message-directory (expand-file-name "~/.mail"))
(setq gnus-directory (expand-file-name "~/.emacs.d/news"))
(setq nnfolder-directory (expand-file-name "~/.mail/archive"))
(setq nnfolder-directory "~/.mail/archive")
(setq nnfolder-active-file "~/.mail/archive/active")
(setq gnus-server-alist '(("archive" nnfolder "archive"
                           (nnfolder-directory "~/.mail/archive")
                           (nnfolder-active-file "~/.mail/archive/active")
                           (nnfolder-get-new-mail nil)
                           (nnfolder-inhibit-expiry t))))
(setq mail-default-directory "~/.mail")
(setq smtpmail-queue-dir "~/.mail/.queued-mail")

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

Gnus is running good, and I am trying to add searching capabilities to
my, already organized, email.

Doing an epheremal search using 'G G' with point on a nnmaildir group is
giving me the error above. Doing the same of my Topic of my nnmaildir
groups also give me this error.

My GNU system has `grep` installed. I don't want to do searches on my
maildirs with any other searching methods/executables.

Did not crash.

In GNU Emacs 29.4 (build 2, x86_64-pc-linux-gnu) of 2024-09-29 built on
 torre
Repository revision: 6a299b3caceb2c73b932ba73849738faa8c5d975
Repository branch: release
System Description: Parabola GNU/Linux-libre

Configured using:
 'configure --without-x --with-x=no --with-x-toolkit=no --without-dbus
 --without-gconf --without-gsettings --without-toolkit-scroll-bars
 --without-xim --disable-largefile --with-modules --without-libsystemd
 --without-cairo --without-gpm'

Configured features:
ACL GMP GNUTLS JSON LCMS2 LIBXML2 MODULES NOTIFY INOTIFY PDUMPER SECCOMP
SOUND SQLITE3 THREADS TREE_SITTER XIM ZLIB

Important settings:
  value of $LANG: pt_PT.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  bug-reference-prog-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-autoaway-mode: t
  erc-log-mode: t
  windmove-mode: t
  shell-dirtrack-mode: t
  gpm-mouse-mode: t
  rainbow-delimiters-mode: t
  paredit-mode: t
  emms-mode-line-mode: t
  emms-playing-time-display-mode: t
  emms-playing-time-mode: t
  jabber-activity-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  erc-networks-mode: t
  server-mode: t
  winner-mode: t
  display-time-mode: t
  electric-pair-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  tab-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: linux
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/guest/me/programming/desktop/emacs-jabber/lisp/jabber-autoloads hides /home/guest/me/programming/desktop/emacs-jabber/jabber-autoloads
/home/guest/.emacs.d/elpa/transient-20240918.1138/transient hides /usr/local/share/emacs/29.4/lisp/transient

Features:
(shadow emacsbug bug-reference grep apropos info-look emacs-news-mode
face-remap gnus-search markdown-mode noutline outline vc-git diff-mode
vc-dispatcher webjump view diary-lib diary-loaddefs solar cal-dst
holidays holiday-loaddefs cal-move mailalias erc-list erc-menu erc-ring
erc-pcomplete erc-track erc-match erc-button erc-fill erc-stamp
erc-netsplit erc-autoaway erc-log dired-aux ispell pcmpl-unix pcmpl-gnu
canlock cl-print re-builder tabify imenu man epa-mail transpose-frame
windmove mail-extr gnus-bcklg compile expand-region text-mode-expansions
html-mode-expansions er-basic-expansions expand-region-core
expand-region-custom misearch multi-isearch textsec uni-scripts
idna-mapping ucs-normalize uni-confusable textsec-check eww xdg gnus-ml
jka-compr disp-table mule-util display-line-numbers shortdoc gnus-async
gnus-cite gnus-cus gnus-demon gnus-diary nndiary gnus-draft gnus-dup
gnus-fun gnus-html url-queue gnus-kill gnus-logic gnus-mh mh-comp
mh-scan mh-gnus mh-e mh-buffers mh-loaddefs gnus-registry registry
rmailsum rmail gnus-salt gnus-uu yenc gnus-vm nnselect help-fns
radix-tree qp cus-edit cus-start cus-load jabber-rtt captain
sasl-scram-rfc sasl-scram-sha-1 rfc2104 hex-util sh-script rx smie
treesit executable files-x shell pcomplete gnus-topic mm-archive
url-http url-gw url-cache url-auth nndraft nnmh nnrss utf-7 epa-file
network-stream nsm nnfolder nnmaildir gnus-agent gnus-srvr gnus-score
score-mode nnvirtual nntp gnus-cache t-mouse term/linux
rainbow-delimiters paredit go-translate go-translate-v2
gts-engine-youdao gts-engine-stardict gts-engine-deepl
gts-engine-google-rpc gts-engine-google gts-engine-bing gts-implements
gts-faces gts-core warnings icons gt-text-utility gt-engine-echo
gt-engine-chatgpt gt-engine-youdao gt-engine-stardict gt-engine-deepl
gt-engine-google-rpc gt-engine-google gt-engine-bing gt-extension
gt-faces gt-core let-alist transient edmacro kmacro emms-idapi-browser
emms-idapi emms-idapi-musicbrainz emms-mpris emms-librefm-stream
emms-librefm-scrobbler emms-playlist-limit emms-i18n emms-history
emms-score emms-stream-info emms-metaplaylist-mode emms-bookmarks
emms-cue emms-mode-line-icon emms-browser sort emms-volume easy-mmode
emms-volume-sndioctl emms-volume-mixerctl emms-volume-pulse
emms-volume-amixer emms-playlist-sort emms-last-played emms-player-xine
emms-player-mpd tq emms-lyrics emms-url emms-streams emms-show-all
emms-tag-editor emms-tag-tracktag emms-mark emms-mode-line emms-cache
emms-info-native emms-info-native-spc emms-info-native-mp3
emms-info-native-ogg emms-info-native-opus emms-info-native-flac
emms-info-native-vorbis bindat emms-info-tinytag emms-info-metaflac
emms-info-opusinfo emms-info-ogginfo emms-info-mp3info
emms-playlist-mode emms-player-vlc emms-player-mpv emms-playing-time
emms-player-mplayer emms-player-simple emms-source-playlist
emms-source-file locate emms-setup emms-info-exiftool emms-info
emms-later-do emms emms-compat jabber-httpupload jabber jabber-time
jabber-autoaway jabber-vcard-avatars jabber-chatstates jabber-events
jabber-vcard jabber-avatar jabber-activity jabber-watch jabber-modeline
jabber-ahc-presence jabber-ahc jabber-version jabber-ourversion
jabber-muc-nick-completion hippie-exp comint ansi-osc ansi-color
jabber-muc jabber-bookmarks jabber-muc-nick-coloring color jabber-browse
jabber-search jabber-register jabber-widget jabber-chat jabber-history
jabber-chatbuffer jabber-roster jabber-carbons jabber-presence
jabber-private jabber-logon jabber-conn srv dns starttls jabber-core
jabber-keepalive jabber-ping jabber-disco jabber-iq jabber-console
sgml-mode facemenu jabber-truncate ewoc jabber-alert jabber-keymap
jabber-sasl sasl sasl-anonymous sasl-login sasl-plain jabber-menu
jabber-util jabber-xml goto-addr fsm jabber-autoloads weri erc-goodies
erc thingatpt pp format-spec erc-backend erc-networks erc-common
erc-compat compat compat-30 erc-loaddefs ebdb-message ebdb-gnus gnus-msg
gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr
pixel-fill kinsoku url-file svg dom gnus-group gnus-undo gnus-start
gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 nnoo
parse-time iso8601 gnus-spec gnus-int gnus-range message yank-media puny
dired dnd dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 gmm-utils
mailheader gnus-win ebdb-mua ebdb-com crm ebdb-format ebdb regexp-opt
mailabbrev eieio-opt cl-extra help-mode speedbar ezimage dframe
find-func eieio-base cal-menu calendar cal-loaddefs timezone server
pinentry advice mm-url gnus nnheader gnus-util text-property-search
time-date range wid-edit smtpmail sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils winner ring ido time image elec-pair
my-lisp 0x0-autoloads 0xc-autoloads 2048-game-autoloads 2bit-autoloads
4clojure-autoloads captain-autoloads clhs-autoloads ebdb-autoloads
emms-autoloads expand-region-autoloads fsm-autoloads
ledger-mode-autoloads magit-autoloads pcase magit-section-autoloads
dash-autoloads markdown-mode-autoloads paredit-autoloads
pinentry-autoloads plisp-mode-autoloads po-mode-autoloads
rainbow-delimiters-autoloads request-autoloads s-autoloads srv-autoloads
transient-autoloads transpose-frame-autoloads with-editor-autoloads info
tool-bar compat-autoloads package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv
bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip
cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads inotify lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 1817214 244127)
 (symbols 48 138452 33)
 (strings 32 363961 65668)
 (string-bytes 1 15169011)
 (vectors 16 111054)
 (vector-slots 8 3315957 244523)
 (floats 8 1026 1222)
 (intervals 56 138365 3776)
 (buffers 984 58))