From d893bb2da03711760d46c6a0eebff4076b507a49 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Wed, 12 Mar 2014 16:03:05 +2000 Subject: [PATCH] [PATCH] util: Fix corner-case in boolean term quoting function --- 77/fc55935f99a0282584df38cc65d730e6605372 | 100 ++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 77/fc55935f99a0282584df38cc65d730e6605372 diff --git a/77/fc55935f99a0282584df38cc65d730e6605372 b/77/fc55935f99a0282584df38cc65d730e6605372 new file mode 100644 index 000000000..5b8230a0f --- /dev/null +++ b/77/fc55935f99a0282584df38cc65d730e6605372 @@ -0,0 +1,100 @@ +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 D86F9431FBF + for ; Tue, 11 Mar 2014 13:03:24 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 poDiAt001EjV for ; + Tue, 11 Mar 2014 13:03:18 -0700 (PDT) +Received: from dmz-mailsec-scanner-5.mit.edu (dmz-mailsec-scanner-5.mit.edu + [18.7.68.34]) + by olra.theworths.org (Postfix) with ESMTP id 79E53431FBD + for ; Tue, 11 Mar 2014 13:03:18 -0700 (PDT) +X-AuditID: 12074422-f79526d000000c47-e4-531f6c055571 +Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) + (using TLS with cipher AES256-SHA (256/256 bits)) + (Client did not present a certificate) + by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP + id 3E.EE.03143.50C6F135; Tue, 11 Mar 2014 16:03:18 -0400 (EDT) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id s2BK3FMT013140; + Tue, 11 Mar 2014 16:03:15 -0400 +Received: from drake.dyndns.org (26-4-172.dynamic.csail.mit.edu [18.26.4.172]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s2BK3DPw022649 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Tue, 11 Mar 2014 16:03:15 -0400 +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1WNStN-0005i8-Jr; Tue, 11 Mar 2014 16:03:13 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH] util: Fix corner-case in boolean term quoting function +Date: Tue, 11 Mar 2014 16:03:05 -0400 +Message-Id: <1394568185-21913-1-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.8.4.rc3 +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFprJIsWRmVeSWpSXmKPExsUixCmqrMuWIx9scL3a4vrNmcwOjB7PVt1i + DmCM4rJJSc3JLEst0rdL4MqYsCyn4BxHxaL+16wNjHfYuhg5OSQETCQ2NP1igbDFJC7cWw8U + 5+IQEpjNJNH18QgThLORUWLZ3OlQzhEmif3bDjJDOHMZJTZcX8EE0s8moCGxbf9yRhBbREBa + Yufd2axdjBwczAJqEn+6VEDCwgLuEu8WzgRbzSKgKrGh+QIziM0r4CDxY3EH1BlKEgtPbWOd + wMi7gJFhFaNsSm6Vbm5iZk5xarJucXJiXl5qka6pXm5miV5qSukmRlAIsLso7WD8eVDpEKMA + B6MSD6+DgnywEGtiWXFl7iFGSQ4mJVHeD+lAIb6k/JTKjMTijPii0pzU4kOMEhzMSiK8HzWB + crwpiZVVqUX5MClpDhYlcd6+sxLBQgLpiSWp2ampBalFMFkZDg4lCd6XWUCNgkWp6akVaZk5 + JQhpJg5OkOE8QMMFskGGFxck5hZnpkPkTzEqSonzOoA0C4AkMkrz4HphMfqKURzoFWHeeyBV + PMD4hut+BTSYCWjwjwCwwSWJCCmpBkbOxA+dJ/5NNr42/9bUhvnJb+xWnVgUX9Vfbf/kos/T + rQvCTwpcs5vtP3npz5vNwg2MJlorvbWmPpwmpTxp4fbZQitNdRrcb2Tclv3Ud9Fw+/dKDwcT + tRkcDw5PSbZ7GTlDOCL6p8ch7ZqE0rl8IctcfF9kbw/2THxySU/9/+nuElOTw8UK7jpKLMUZ + iYZazEXFiQAoJxFgrAIAAA== +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: Tue, 11 Mar 2014 20:03:25 -0000 + +Previously, make_boolean_term did not quote boolean terms that started +with '('. This is incompatible with Xapian, since boolean terms that +start with '(' trigger an alternate term quoting syntax. + +Fix this by quoting terms that contain '('. +--- + util/string-util.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/util/string-util.c b/util/string-util.c +index 9e2f728..fd3ceb2 100644 +--- a/util/string-util.c ++++ b/util/string-util.c +@@ -75,10 +75,10 @@ make_boolean_term (void *ctx, const char *prefix, const char *term, + int need_quoting = 0; + + /* Do we need quoting? To be paranoid, we quote anything +- * containing a quote, even though it only matters at the ++ * containing a quote or '(', even though these only matter at the + * beginning, and anything containing non-ASCII text. */ + for (in = term; *in && !need_quoting; in++) +- if (is_unquoted_terminator (*in) || *in == '"' ++ if (is_unquoted_terminator (*in) || *in == '"' || *in == '(' + || (unsigned char)*in > 127) + need_quoting = 1; + +-- +1.8.4.rc3 + -- 2.26.2