Re: [PATCH 0/2] Escape message ID queries in Emacs
authorAustin Clements <amdragon@MIT.EDU>
Tue, 27 Mar 2012 07:01:52 +0000 (03:01 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:45:47 +0000 (09:45 -0800)
b3/7b4800b9c6025e4ec8dffa545e7ab88a4f80f8 [new file with mode: 0644]

diff --git a/b3/7b4800b9c6025e4ec8dffa545e7ab88a4f80f8 b/b3/7b4800b9c6025e4ec8dffa545e7ab88a4f80f8
new file mode 100644 (file)
index 0000000..5373953
--- /dev/null
@@ -0,0 +1,122 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 79719431FAF\r
+       for <notmuch@notmuchmail.org>; Tue, 27 Mar 2012 00:01:59 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id TRKZCiH6bAhs for <notmuch@notmuchmail.org>;\r
+       Tue, 27 Mar 2012 00:01:59 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU\r
+       [18.9.25.15])\r
+       by olra.theworths.org (Postfix) with ESMTP id D64C7431FAE\r
+       for <notmuch@notmuchmail.org>; Tue, 27 Mar 2012 00:01:58 -0700 (PDT)\r
+X-AuditID: 1209190f-b7f8a6d000000914-ab-4f7165e53a39\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 14.60.02324.5E5617F4; Tue, 27 Mar 2012 03:01:57 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q2R71u2w005720; \r
+       Tue, 27 Mar 2012 03:01:57 -0400\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q2R71rn7023101\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Tue, 27 Mar 2012 03:01:55 -0400 (EDT)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1SCQPg-0007kJ-Dp; Tue, 27 Mar 2012 03:01:52 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 0/2] Escape message ID queries in Emacs\r
+In-Reply-To: <m2sjgutuck.fsf@guru.guru-group.fi>\r
+References: <1332812236-20387-1-git-send-email-amdragon@mit.edu>\r
+       <m2sjgutuck.fsf@guru.guru-group.fi>User-Agent:\r
+       Notmuch/0.12+68~g2b97293 (http://notmuchmail.org) Emacs/23.3.1\r
+       (i486-pc-linux-gnu)\r
+Date: Tue, 27 Mar 2012 03:01:52 -0400\r
+Message-ID: <87aa32h6hr.fsf@awakening.csail.mit.edu>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFrrCIsWRmVeSWpSXmKPExsUixCmqrPs0tdDfYGWDisX1mzOZLd6snMfq\r
+       wORx+OtCFo9nq24xBzBFcdmkpOZklqUW6dslcGU07zjAVLCTp+Jkr34DYzdXFyMnh4SAicTf\r
+       Q7eYIWwxiQv31rN1MXJxCAnsY5S4vPwvI4SzgVHi9/ePzBDOSSaJJ1fvQpUtYZR42vGNEaSf\r
+       TUBDYtv+5WC2iICtxJUlJ1lBbGEBa4kH/x+zg9icAgYSkz5PZ4doPsQoMefuf6YuRg4OFgFV\r
+       id710SAmL9BNP+Z6g5TzCghKnJz5hAXEZhbQkrjx7yXTBEb+WUhSs5CkFjAyrWKUTcmt0s1N\r
+       zMwpTk3WLU5OzMtLLdI10cvNLNFLTSndxAgOPEn+HYzfDiodYhTgYFTi4TWaXuAvxJpYVlyZ\r
+       e4hRkoNJSZTXI7nQX4gvKT+lMiOxOCO+qDQntRjoXg5mJRFe7SigHG9KYmVValE+TEqag0VJ\r
+       nFdN652fkEB6YklqdmpqQWoRTFaGg0NJglcfGGFCgkWp6akVaZk5JQhpJg5OkOE8QMNNQGp4\r
+       iwsSc4sz0yHypxgVpcR5A0ASAiCJjNI8uF5YYnjFKA70ijCvKUgVDzCpwHW/AhrMBDR4yZF8\r
+       kMEliQgpqQbGxCtFExVyE6zkmBRTrwnNOmacrGrC9TAu/5/PbC2NubIf2M0O7bOVqJI4Hy/i\r
+       lKqq21r8cgX/7EcaLsX3PtXFP/34ILTHsO4eZ5Z1nGvaVWmnHhGTxPZ5Ev6/Uj+rHa/7EBQ6\r
+       YWr3Ws2Jeoa/mSKsb0xRelH6We/LMaUkleLWfN0tnulGQUosxRmJhlrMRcWJAE5bLynnAgAA\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 27 Mar 2012 07:01:59 -0000\r
+\r
+On Tue, 27 Mar 2012, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
+> On Tue, Mar 27 2012, Austin Clements wrote:\r
+>\r
+>> Currently, Emacs does not escape message ID queries and is\r
+>> inconsistent about quoting them.  This patch centralizes this in one\r
+>> function that always produces a properly quoted and escaped message ID\r
+>> query.\r
+>>\r
+>> With this, Emacs no longer gets confused by Tomi's crazy message,\r
+>>   id:"id:""1332281811-24710-2b-git-send-email-tomi.ollila@iki.fi"""\r
+>\r
+> LGTM. Things work!\r
+>\r
+>\r
+> One observation, though:\r
+>\r
+> In search bar the following queries return one match:\r
+>\r
+> id:id:"1332281811-24710-2b-git-send-email-tomi.ollila@iki.fi"\r
+> id:"id:""1332281811-24710-2b-git-send-email-tomi.ollila@iki.fi"""\r
+>\r
+> but\r
+>\r
+> id:"id:"1332281811-24710-2b-git-send-email-tomi.ollila@iki.fi""\r
+>\r
+> return 0 matches.\r
+>\r
+> It looks like the (above) search strings goes verbatim to command line\r
+>\r
+> i.e. 'notmuch' 'search' '--sort=oldest-first' 'id:...'\r
+>\r
+> can be used to compare... so that would be CLI issue if there\r
+> is ever need to do do anything with it.\r
+\r
+I'm not sure I would consider this a CLI "issue".  It may not be\r
+intuitive, but it is an intentional part of the Xapian query parser's\r
+grammar.  If a boolean prefix is followed immediately by a quote, then\r
+the term is between that quote and the next quote, modulo an escaping\r
+rule that lets you include a literal quote in the term by doubling it in\r
+the query string.  Together, these rules let you reliably put anything\r
+in a boolean search term.\r
+\r
+> +1\r
+>\r
+> Thanks for fixing this.\r
+>\r
+> Tomi\r