* [PATCH v2] util: Fix two corner-cases in boolean term quoting function
@ 2014-03-11 20:42 Austin Clements
2014-03-15 18:24 ` David Bremner
0 siblings, 1 reply; 2+ messages in thread
From: Austin Clements @ 2014-03-11 20:42 UTC (permalink / raw)
To: notmuch
Previously, make_boolean_term did not quote empty boolean terms or
boolean terms that started with '('. These cases are incompatible
with Xapian: empty terms cannot be omitted, and boolean terms that
start with '(' trigger an alternate term quoting syntax.
Fix this by quoting empty terms and terms that contain '('.
---
The previous version missed the empty term case.
util/string-util.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/util/string-util.c b/util/string-util.c
index 9e2f728..3e7066c 100644
--- a/util/string-util.c
+++ b/util/string-util.c
@@ -75,10 +75,12 @@ 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. */
+ if (! term[0])
+ need_quoting = 1;
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] util: Fix two corner-cases in boolean term quoting function
2014-03-11 20:42 [PATCH v2] util: Fix two corner-cases in boolean term quoting function Austin Clements
@ 2014-03-15 18:24 ` David Bremner
0 siblings, 0 replies; 2+ messages in thread
From: David Bremner @ 2014-03-15 18:24 UTC (permalink / raw)
To: Austin Clements, notmuch
Austin Clements <amdragon@MIT.EDU> writes:
> Previously, make_boolean_term did not quote empty boolean terms or
> boolean terms that started with '('. These cases are incompatible
> with Xapian: empty terms cannot be omitted, and boolean terms that
> start with '(' trigger an alternate term quoting syntax.
pushed,
d
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-15 18:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-11 20:42 [PATCH v2] util: Fix two corner-cases in boolean term quoting function Austin Clements
2014-03-15 18:24 ` David Bremner
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).