From d138950ae16fd74776e0f846d0d5a93cf1439963 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Mon, 3 Feb 2014 22:36:30 +0200 Subject: [PATCH] Re: sanitization of args notmuch-cli in notmuch-emacs --- bc/0ec83630794a92a2c4effd005a898bd323eada | 107 ++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 bc/0ec83630794a92a2c4effd005a898bd323eada diff --git a/bc/0ec83630794a92a2c4effd005a898bd323eada b/bc/0ec83630794a92a2c4effd005a898bd323eada new file mode 100644 index 000000000..9387e499a --- /dev/null +++ b/bc/0ec83630794a92a2c4effd005a898bd323eada @@ -0,0 +1,107 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 25450429E2F + for ; Mon, 3 Feb 2014 12:37:09 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 8n2mu1HHpif8 for ; + Mon, 3 Feb 2014 12:36:41 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 7729B431FAF + for ; Mon, 3 Feb 2014 12:36:41 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 5AFC6100033; + Mon, 3 Feb 2014 22:36:32 +0200 (EET) +From: Tomi Ollila +To: David Bremner , notmuch@notmuchmail.org +Subject: Re: sanitization of args notmuch-cli in notmuch-emacs +In-Reply-To: <87wqhcxb5j.fsf@maritornes.cs.unb.ca> +References: <87wqhcxb5j.fsf@maritornes.cs.unb.ca> +User-Agent: Notmuch/0.17+55~g4397960 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 03 Feb 2014 20:37:09 -0000 + +On Mon, Feb 03 2014, David Bremner wrote: + +> Antoine Beaupr=C3=A9 found a bug when notmuch-saved-searches contains=20 +> newlines: +> +> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D737496 +> +> We can remove newlines with something like +>=20=20=20=20=20=20=20=20=20=20=20 +> (mapcar (lambda (arg)=20 +> (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=20 +665 +631 + +$ echo $'foo\n and bar' | notmuch count --batch +665 +A Xapian exception occurred: Syntax: AND +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: AND +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 -- 2.26.2