1 Return-Path: <m.walters@qmul.ac.uk>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 20623431FB6
\r
6 for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 09:50:05 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5
\r
12 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,
\r
13 NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id kK3xDGp7cipu for <notmuch@notmuchmail.org>;
\r
17 Sat, 15 Dec 2012 09:50:01 -0800 (PST)
\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 28925431FBC
\r
22 for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 09:50:01 -0800 (PST)
\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])
\r
24 by mail2.qmul.ac.uk with esmtp (Exim 4.71)
\r
25 (envelope-from <m.walters@qmul.ac.uk>)
\r
26 id 1Tjvs2-0004Vc-Gh; Sat, 15 Dec 2012 17:49:56 +0000
\r
27 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)
\r
28 by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)
\r
29 (envelope-from <m.walters@qmul.ac.uk>)
\r
30 id 1Tjvs2-00001O-3Q; Sat, 15 Dec 2012 17:49:54 +0000
\r
31 From: Mark Walters <markwalters1009@gmail.com>
\r
32 To: david@tethera.net, notmuch@notmuchmail.org
\r
33 Subject: Re: [Patch v7 05/14] quote_and_decode_query: new function to quote
\r
35 In-Reply-To: <1355492062-7546-6-git-send-email-david@tethera.net>
\r
36 References: <1355492062-7546-1-git-send-email-david@tethera.net>
\r
37 <1355492062-7546-6-git-send-email-david@tethera.net>
\r
38 User-Agent: Notmuch/0.14+155~g7edfdc3 (http://notmuchmail.org) Emacs/23.4.1
\r
39 (x86_64-pc-linux-gnu)
\r
40 Date: Sat, 15 Dec 2012 17:49:55 +0000
\r
41 Message-ID: <87zk1f8at8.fsf@qmul.ac.uk>
\r
43 Content-Type: text/plain; charset=us-ascii
\r
44 X-Sender-Host-Address: 93.97.24.31
\r
45 X-QM-SPAM-Info: Sender has good ham record. :)
\r
46 X-QM-Body-MD5: 38bb0874714125ffc2484fd026037717 (of first 20000 bytes)
\r
47 X-SpamAssassin-Score: -1.8
\r
48 X-SpamAssassin-SpamBar: -
\r
49 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
51 spam. We require at least 5.0 points to mark a message as spam.
\r
52 This message scored -1.8 points.
\r
53 Summary of the scoring:
\r
54 * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,
\r
56 * [138.37.6.40 listed in list.dnswl.org]
\r
57 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
58 provider * (markwalters1009[at]gmail.com)
\r
59 * 0.5 AWL AWL: From: address is in the auto white-list
\r
60 X-QM-Scan-Virus: ClamAV says the message is clean
\r
61 Cc: David Bremner <bremner@debian.org>
\r
62 X-BeenThere: notmuch@notmuchmail.org
\r
63 X-Mailman-Version: 2.1.13
\r
65 List-Id: "Use and development of the notmuch mail system."
\r
66 <notmuch.notmuchmail.org>
\r
67 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
70 List-Post: <mailto:notmuch@notmuchmail.org>
\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
72 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
74 X-List-Received-Date: Sat, 15 Dec 2012 17:50:05 -0000
\r
77 On Fri, 14 Dec 2012, david@tethera.net wrote:
\r
78 > From: David Bremner <bremner@debian.org>
\r
80 > The query is split into tokens, with ' ' and ':' as delimiters. Any
\r
81 > token containing some hex-escaped character is quoted according to
\r
82 > Xapian rules. This maps id:foo%20%22bar to id:"foo ""bar".
\r
83 > This intentionally does not quote prefixes, so they still work as prefixes.
\r
85 > tag-util.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
\r
86 > 1 file changed, 50 insertions(+)
\r
88 > diff --git a/tag-util.c b/tag-util.c
\r
89 > index f89669a..e1181f8 100644
\r
92 > @@ -56,6 +56,56 @@ illegal_tag (const char *tag, notmuch_bool_t remove)
\r
96 > +static tag_parse_status_t
\r
97 > +quote_and_decode_query (void *ctx, char *encoded, const char *line_for_error,
\r
98 > + char **query_string)
\r
101 Would decode_and_quote_query be a better name given the order these two
\r
102 happen? Also a comment describing the function would be nice.
\r
104 > + char *tok = encoded;
\r
105 > + size_t tok_len = 0;
\r
106 > + char *buf = NULL;
\r
107 > + size_t buf_len = 0;
\r
108 > + tag_parse_status_t ret = TAG_PARSE_SUCCESS;
\r
110 > + *query_string = talloc_strdup (ctx, "");
\r
112 > + while (*query_string &&
\r
113 > + (tok = strtok_len (tok + tok_len, ": ", &tok_len)) != NULL) {
\r
114 > + char delim = tok[tok_len];
\r
116 > + *(tok + tok_len++) = '\0';
\r
118 These two look a little odd: I would prefer either array or pointer in
\r
122 > + if (strcspn (tok, "%") < tok_len - 1) {
\r
123 > + /* something to decode */
\r
124 > + if (hex_decode_inplace (tok) != HEX_SUCCESS) {
\r
125 > + ret = line_error (TAG_PARSE_INVALID, line_for_error,
\r
126 > + "hex decoding of token '%s' failed", tok);
\r
130 > + if (double_quote_str (ctx, tok, &buf, &buf_len)) {
\r
131 > + ret = line_error (TAG_PARSE_OUT_OF_MEMORY,
\r
132 > + line_for_error, "aborting");
\r
135 > + *query_string = talloc_asprintf_append_buffer (
\r
136 > + *query_string, "%s%c", buf, delim);
\r
139 > + /* This is not just an optimization, but used to preserve
\r
140 > + * prefixes like id:, which cannot be quoted.
\r
142 > + *query_string = talloc_asprintf_append_buffer (
\r
143 > + *query_string, "%s%c", tok, delim);
\r
146 What happens if a message id (for example) contains a ':'? Is a query of
\r
149 id:stuff"encoded_stuff"
\r
151 acceptable? (As far as I can see from the man page ':' does not need to
\r
163 > + if (ret != TAG_PARSE_SUCCESS && *query_string)
\r
164 > + talloc_free (*query_string);
\r
168 > tag_parse_status_t
\r
169 > parse_tag_line (void *ctx, char *line,
\r
170 > tag_op_flag_t flags,
\r
174 > _______________________________________________
\r
175 > notmuch mailing list
\r
176 > notmuch@notmuchmail.org
\r
177 > http://notmuchmail.org/mailman/listinfo/notmuch
\r