sanitization of args notmuch-cli in notmuch-emacs

Tomi Ollila tomi.ollila at iki.fi
Mon Feb 3 12:36:30 PST 2014


On Mon, Feb 03 2014, David Bremner <david at tethera.net> wrote:

> Antoine Beaupré found a bug when notmuch-saved-searches contains 
> newlines:
>
>         http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=737496
>
> We can remove newlines with something like
>           
> (mapcar (lambda (arg) 
> 	  (replace-regexp-in-string "\n" " " arg))
> 	args)
>
> I wonder if we should do some other sanitization at the same time?

It took a while to reproduce...

$ echo $'foo\nbar' | notmuch count --batch 
665
631

$ echo $'foo\n and bar' | notmuch count --batch
665
A Xapian exception occurred: Syntax: <expression> AND <expression>
Query string was:  and bar
0

Therefore: (wrong-type-argument number-or-marker-p A)

(I run non-byte-compiled version of (one-) notmuch.el and
got this as a backtrace:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p A)
  >(A 0)
  (or (plist-get options :show-empty-searches) (> message-count 0))
...
  (notmuch-remove-if-not
...
  notmuch-hello-query-counts
...

simpler way to reproduce:

$ notmuch count 'and bar'
A Xapian exception occurred: Syntax: <expression> AND <expression>
Query string was: and bar
0

Maybe the cli should be fixed ? (and/or make emacs MUA resilient to
this kind of result)

>
> d
>

Tomi


More information about the notmuch mailing list