GNU bug report logs - #45770
28.0.50; `gnus-search-run-search' for imap does not take parentheses into account

Previous Next

Packages: emacs, gnus;

Reported by: Michael Welsh Duggan <mwd <at> md5i.com>

Date: Sun, 10 Jan 2021 17:50:02 UTC

Severity: normal

Tags: moreinfo

Found in version 28.0.50

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 45770 in the body.
You can then email your comments to 45770 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#45770; Package emacs,gnus. (Sun, 10 Jan 2021 17:50:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Welsh Duggan <mwd <at> md5i.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org. (Sun, 10 Jan 2021 17:50:02 GMT) Full text and rfc822 format available.

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

From: Michael Welsh Duggan <mwd <at> md5i.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; `gnus-search-run-search' for imap does not take
 parentheses into account
Date: Sun, 10 Jan 2021 12:49:04 -0500
[Message part 1 (text/plain, inline)]
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.

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

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.

Example:

C-u G G "((OR" RET

This results in something like:

577841 BAD Error in IMAP command UID SEARCH: Missing ')' (0.001 + 0.000 secs).

in the process buffer.

Here's a small patch for the first two issues:

[Message part 2 (text/x-patch, inline)]
diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el
index 44f43b073c..f20f9586d2 100644
--- a/lisp/gnus/gnus-search.el
+++ b/lisp/gnus/gnus-search.el
@@ -1036,7 +1036,7 @@ gnus-search-imap-search-keys
   '(body cc bcc from header keyword larger smaller subject text to uid x-gm-raw
 	 answered before deleted draft flagged on since recent seen sentbefore
 	 senton sentsince unanswered undeleted undraft unflagged unkeyword
-	 unseen all)
+         unseen all new not old or)
   "Known IMAP search keys.")
 
 ;; imap interface
@@ -1072,9 +1072,9 @@ gnus-search-imap-search-keys
       ;; A bit of backward-compatibility slash convenience: if the
       ;; query string doesn't start with any known IMAP search
       ;; keyword, assume it is a "TEXT" search.
-      (unless (and (string-match "\\`[^[:blank:]]+" q-string)
+      (unless (and (string-match "\\`(*\\([^[:blank:]]+\\)" q-string)
 		   (memql (intern-soft (downcase
-					(match-string 0 q-string)))
+                                        (match-string 1 q-string)))
 			  gnus-search-imap-search-keys))
 	(setq q-string (concat "TEXT " q-string)))

[Message part 3 (text/plain, inline)]
In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0)
 of 2020-12-20 built on maru2
Repository revision: 27347db0069f9d9fd0152274bfc7c649c387f185
Repository branch: md5i
Windowing system distributor 'The X.Org Foundation', version 11.0.12009000
System Description: Debian GNU/Linux bullseye/sid

Configured using:
 'configure --with-modules --without-toolkit-scroll-bars
 --with-x-toolkit=lucid --with-wide-int --with-gameuser=:staff
 'CFLAGS=-Og -ggdb3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF
ZLIB LUCID X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON PDUMPER LCMS2

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Group

Minor modes in effect:
  gnus-topic-mode: t
  cursor-sensor-mode: t
  gnus-undo-mode: t
  display-time-mode: t
  magit-wip-initial-backup-mode: t
  magit-wip-before-change-mode: t
  magit-wip-after-apply-mode: t
  magit-wip-after-save-mode: t
  magit-wip-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  shell-dirtrack-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t

Load-path shadows:
/home/md5i/.emacs.d/elpa/cmake-mode-20201217.1410/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode

Features:
(nroff-mode prolog align ps-bdf ps-mule markdown-mode gnus-eform
sh-script smie executable cmake-font-lock cmake-mode autoload tar-mode
arc-mode archive-mode lisp-mnt url-http url-gw url-auth finder-inf xref
project profiler timer-list goto-addr vc-mtn vc-src vc-sccs vc-svn
vc-cvs vc-rcs vc vc-dispatcher bug-reference tex-mode latexenc rst
pcmpl-unix man generic thai-util thai-word org-element avl-tree
generator ol-eww eww xdg ol-rmail ol-mhe ol-irc ol-info ol-gnus
ol-docview doc-view ol-bibtex bibtex ol-bbdb ol-w3m org ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint
org-pcomplete org-list org-faces org-entities org-version ob-emacs-lisp
ob-core ob-eval org-table ol org-keys org-compat org-macs org-loaddefs
cal-menu calendar cal-loaddefs image-mode exif zenscript-mode
zenscript-indentation zenscript-completion zenscript-language
zenscript-parser zenscript-highlighting zenscript-common calc-undo js
vc-hg vc-bzr tramp-cmds rfc2104 noutline outline tramp-cache novice
magit-extras face-remap conf-mode dired-aux shr-color color flow-fill
calc-misc calc-alg calc-ext calc-menu calc calc-loaddefs calc-macs
mm-archive gnus-bcklg qp copyright time-stamp whitespace tabify grep
compile shadow sort mail-extr emacsbug vc-git dabbrev edebug deuglify
gnus-async gnus-cite gnus-cus gnus-diary nndiary gnus-draft gnus-dup
gnus-fun gnus-html url-queue url-cache mm-url gnus-kill gnus-logic
gnus-mh mh-comp mh-scan mh-gnus mh-e mh-compat mh-buffers mh-loaddefs
gnus-registry registry eieio-base gnus-salt gnus-uu yenc gnus-vm
sendmail mule-util cl-print debug backtrace misearch multi-isearch
jka-compr thingatpt shortdoc help-fns radix-tree gnus-ml disp-table
nnselect gnus-search eieio-opt speedbar ezimage dframe find-func
gnus-topic cursor-sensor utf-7 nndraft nnmh epa-file network-stream nsm
nnml gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg
gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-cache gnus-sum
shr kinsoku svg gnus-demon nntp gnus-group gnus-undo gnutls gnus-start
gnus-dbus gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo gnus-spec
gnus-int gnus-range gnus-win gnus nnheader flyspell ispell view uptimes
descr-text tramp-sh cus-edit pp cus-start cus-load tramp tramp-loaddefs
trampver tramp-integration files-x tramp-compat parse-time iso8601
ls-lisp time sieve-manage sasl sasl-anonymous sasl-login sasl-plain
rng-loc rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse
nxml-ns nxml-enc xmltok nxml-util sgml-mode dom psvn wid-edit cl
ps-print ps-print-loaddefs ps-def lpr picture magit-submodule
magit-obsolete magit-blame magit-stash magit-reflog magit-bisect
magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff
smerge-mode diff diff-mode magit-core magit-autorevert autorevert
filenotify magit-margin magit-transient magit-process magit-mode
git-commit transient format-spec magit-git magit-section magit-utils crm
log-edit easy-mmode message rmc puny rfc822 mml mml-sec epa gnus-util
rmail rmail-loaddefs text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log
with-editor cl-extra help-mode async-bytecomp advice async shell
pcomplete server dash lua-mode rx comint ansi-color ring generated
generic-x epg epg-config ediff ediff-merg ediff-mult ediff-wind
ediff-diff ediff-help ediff-init ediff-util pcase dbus xml desktop
frameset dired-x dired dired-loaddefs cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs edmacro kmacro
derived debian-el info package easymenu browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame minibuffer cl-generic
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 charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 3100306 317740)
 (symbols 48 59489 65)
 (strings 32 300970 101472)
 (string-bytes 1 21728841)
 (vectors 16 156616)
 (vector-slots 8 3056454 276397)
 (floats 8 943 1294)
 (intervals 56 327249 13446)
 (buffers 984 241))

-- 
Michael Welsh Duggan
(md5i <at> md5i.com)

Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#45770; Package emacs,gnus. (Sun, 10 Jan 2021 18:37:01 GMT) Full text and rfc822 format available.

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

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: Michael Welsh Duggan <mwd <at> md5i.com>
Cc: 45770 <at> debbugs.gnu.org
Subject: Re: bug#45770: 28.0.50; `gnus-search-run-search' for imap does not
 take parentheses into account
Date: Sun, 10 Jan 2021 10:36:01 -0800
Michael Welsh Duggan <mwd <at> md5i.com> 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




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#45770; Package emacs,gnus. (Mon, 09 May 2022 13:59:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eric Abrahamsen <eric <at> ericabrahamsen.net>
Cc: Michael Welsh Duggan <mwd <at> md5i.com>, 45770 <at> debbugs.gnu.org
Subject: Re: bug#45770: 28.0.50; `gnus-search-run-search' for imap does not
 take parentheses into account
Date: Mon, 09 May 2022 15:57:51 +0200
Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:

> 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.

Eric, this was a year ago -- was this fixed at the time, or is it still
an issue?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 09 May 2022 13:59:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#45770; Package emacs,gnus. (Mon, 09 May 2022 15:18:02 GMT) Full text and rfc822 format available.

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

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Michael Welsh Duggan <mwd <at> md5i.com>, 45770 <at> debbugs.gnu.org
Subject: Re: bug#45770: 28.0.50; `gnus-search-run-search' for imap does not
 take parentheses into account
Date: Mon, 09 May 2022 08:16:45 -0700
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:
>
>> 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.
>
> Eric, this was a year ago -- was this fixed at the time, or is it still
> an issue?

This was fixed! Sorry, this slipped off my radar. If Michael agrees we
can close this.




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#45770; Package emacs,gnus. (Mon, 09 May 2022 15:19:01 GMT) Full text and rfc822 format available.

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

From: Michael Welsh Duggan <mwd <at> cert.org>
To: Eric Abrahamsen <eric <at> ericabrahamsen.net>, Lars Ingebrigtsen
 <larsi <at> gnus.org>
Cc: Michael Welsh Duggan <mwd <at> md5i.com>,
 "45770 <at> debbugs.gnu.org" <45770 <at> debbugs.gnu.org>
Subject: Re: bug#45770: 28.0.50; `gnus-search-run-search' for imap does not
 take parentheses into account
Date: Mon, 9 May 2022 15:17:58 +0000
No objection here.

________________________________________
From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
Sent: Monday, May 9, 2022 11:16 AM
To: Lars Ingebrigtsen
Cc: Michael Welsh Duggan; 45770 <at> debbugs.gnu.org
Subject: Re: bug#45770: 28.0.50; `gnus-search-run-search' for imap does not take parentheses into account

Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:
>
>> 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.
>
> Eric, this was a year ago -- was this fixed at the time, or is it still
> an issue?

This was fixed! Sorry, this slipped off my radar. If Michael agrees we
can close this.




Reply sent to Eric Abrahamsen <eric <at> ericabrahamsen.net>:
You have taken responsibility. (Mon, 09 May 2022 15:55:01 GMT) Full text and rfc822 format available.

Notification sent to Michael Welsh Duggan <mwd <at> md5i.com>:
bug acknowledged by developer. (Mon, 09 May 2022 15:55:01 GMT) Full text and rfc822 format available.

Message #24 received at 45770-done <at> debbugs.gnu.org (full text, mbox):

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: Michael Welsh Duggan <mwd <at> cert.org>
Cc: Michael Welsh Duggan <mwd <at> md5i.com>, Lars Ingebrigtsen <larsi <at> gnus.org>,
 45770-done <at> debbugs.gnu.org
Subject: Re: bug#45770: 28.0.50; `gnus-search-run-search' for imap does not
 take parentheses into account
Date: Mon, 09 May 2022 08:54:16 -0700
Michael Welsh Duggan <mwd <at> cert.org> writes:

> No objection here.

Thanks.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 07 Jun 2022 11:24:09 GMT) Full text and rfc822 format available.

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

Previous Next


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