Re: [PATCH 1/2] Add Google Inc. to AUTHORS as a contributor.
[notmuch-archives.git] / eb / 850fb5acfe8577d65da2c1a2aa3985cfb99c8e
1 Return-Path: <jani@nikula.org>\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 7A4FF431FAF\r
6         for <notmuch@notmuchmail.org>; Mon, 10 Dec 2012 12:55:50 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id i6abP2XVGI9D for <notmuch@notmuchmail.org>;\r
16         Mon, 10 Dec 2012 12:55:49 -0800 (PST)\r
17 Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com\r
18         [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id AC333431FAE\r
21         for <notmuch@notmuchmail.org>; Mon, 10 Dec 2012 12:55:48 -0800 (PST)\r
22 Received: by mail-lb0-f181.google.com with SMTP id ge1so2496075lbb.26\r
23         for <notmuch@notmuchmail.org>; Mon, 10 Dec 2012 12:55:46 -0800 (PST)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=google.com; s=20120113;\r
26         h=from:to:cc:subject:in-reply-to:references:user-agent:date\r
27         :message-id:mime-version:content-type:x-gm-message-state;\r
28         bh=t6QTYV8wUx4QMjir4HXFW7csFS98jCjdzEupR11oFZY=;\r
29         b=M3HuzKO3X9FUCyWWb9HA7cEnIkRQRRUupH8/AdXycISL74a7SmfznthxzbietyG8ZD\r
30         YwKKbDPnGYxWLXws+DO6UpiMyI37ed/bjwXZkkVawE+PUimLoaHZ6PQsxxlXpU+kIw9f\r
31         G0bkkAfD/dz1YDV3tPjnd9sZG78wxyhPV4k8a4YuF+EBEieY0XjKKHCm1PYFq+fnozoF\r
32         X0FQMig/pYT5m3ejrxrJuyApevCSSKda0S19HZ+glvoSjFp6MqbdJ/mbGH7aiYzRG0If\r
33         gic1k0tGxWQqjH3ZCxR64HiScJh/BjjxQF4s7RiC4aFEoSUXs/HXKS9VlzCrsTNrSdL9\r
34         rQpg==\r
35 Received: by 10.152.114.66 with SMTP id je2mr746231lab.40.1355172945474;\r
36         Mon, 10 Dec 2012 12:55:45 -0800 (PST)\r
37 Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi.\r
38         [80.223.81.27])\r
39         by mx.google.com with ESMTPS id u9sm8403986lbf.5.2012.12.10.12.55.42\r
40         (version=SSLv3 cipher=OTHER); Mon, 10 Dec 2012 12:55:43 -0800 (PST)\r
41 From: Jani Nikula <jani@nikula.org>\r
42 To: david@tethera.net, notmuch@notmuchmail.org\r
43 Subject: Re: [Patch v6 1/6] tag-util: factor out rules for illegal tags,\r
44         use in parse_tag_line\r
45 In-Reply-To: <1355096008-4544-2-git-send-email-david@tethera.net>\r
46 References: <1355096008-4544-1-git-send-email-david@tethera.net>\r
47         <1355096008-4544-2-git-send-email-david@tethera.net>\r
48 User-Agent: Notmuch/0.14+138~g7041c56 (http://notmuchmail.org) Emacs/23.4.1\r
49         (i686-pc-linux-gnu)\r
50 Date: Mon, 10 Dec 2012 22:55:38 +0200\r
51 Message-ID: <87mwxlaaph.fsf@nikula.org>\r
52 MIME-Version: 1.0\r
53 Content-Type: text/plain; charset=us-ascii\r
54 X-Gm-Message-State:\r
55  ALoCoQkGcxQwA1nxCb36bv7uSKIzHFJe7vZmElv6Cs8hW/mkSdr8PvAF+3jBpWnUvkdVtB9/do7X\r
56 Cc: David Bremner <bremner@debian.org>\r
57 X-BeenThere: notmuch@notmuchmail.org\r
58 X-Mailman-Version: 2.1.13\r
59 Precedence: list\r
60 List-Id: "Use and development of the notmuch mail system."\r
61         <notmuch.notmuchmail.org>\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
65 List-Post: <mailto:notmuch@notmuchmail.org>\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
69 X-List-Received-Date: Mon, 10 Dec 2012 20:55:50 -0000\r
70 \r
71 On Mon, 10 Dec 2012, david@tethera.net wrote:\r
72 > From: David Bremner <bremner@debian.org>\r
73 >\r
74 > This will allow us to be consistent between batch tagging and command\r
75 > line tagging as far as what is an illegal tag.\r
76 \r
77 LGTM, with some nitpick and observations below.\r
78 \r
79 Jani.\r
80 \r
81 > ---\r
82 >  tag-util.c |   35 ++++++++++++++++++++++++++++++-----\r
83 >  1 file changed, 30 insertions(+), 5 deletions(-)\r
84 >\r
85 > diff --git a/tag-util.c b/tag-util.c\r
86 > index eab482f..c071ea8 100644\r
87 > --- a/tag-util.c\r
88 > +++ b/tag-util.c\r
89 > @@ -31,6 +31,29 @@ line_error (tag_parse_status_t status,\r
90 >      return status;\r
91 >  }\r
92 >  \r
93 > +/*\r
94 > + * Test tags for some forbidden cases.\r
95 > + *\r
96 > + * return: NULL if OK,\r
97 > + *      explanatory message otherwise.\r
98 > + */\r
99 > +\r
100 > +static const char *\r
101 > +illegal_tag (const char *tag, notmuch_bool_t remove) {\r
102 \r
103 Add \n before opening brace.\r
104 \r
105 > +\r
106 > +    if (*tag == '\0' && !remove)\r
107 > +     return "adding empty tag";\r
108 > +\r
109 > +    /* This disallows adding the non-removable tag "-" and\r
110 > +     * enables notmuch tag to take long options more easily.\r
111 > +     */\r
112 \r
113 Maybe make that: "This disallows adding tags starting with "-",\r
114 including the non-removable tag "-", and enables ...", or similar?\r
115 \r
116 > +\r
117 > +    if (*tag == '-' && !remove)\r
118 > +     return  "adding tag starting with -";\r
119 > +\r
120 > +    return NULL;\r
121 > +}\r
122 > +\r
123 >  tag_parse_status_t\r
124 >  parse_tag_line (void *ctx, char *line,\r
125 >               tag_op_flag_t flags,\r
126 > @@ -95,11 +118,13 @@ parse_tag_line (void *ctx, char *line,\r
127 >       remove = (*tok == '-');\r
128 >       tag = tok + 1;\r
129 >  \r
130 > -     /* Maybe refuse empty tags. */\r
131 > -     if (! (flags & TAG_FLAG_BE_GENEROUS) && *tag == '\0') {\r
132 > -         ret = line_error (TAG_PARSE_INVALID, line_for_error,\r
133 > -                           "empty tag");\r
134 > -         goto DONE;\r
135 > +     /* Maybe refuse illegal tags. */\r
136 > +     if (! (flags & TAG_FLAG_BE_GENEROUS)) {\r
137 > +         const char *msg = illegal_tag (tag, remove);\r
138 > +         if (msg) {\r
139 > +             ret = line_error (TAG_PARSE_INVALID, line_for_error, msg);\r
140 > +             goto DONE;\r
141 > +         }\r
142 >       }\r
143 \r
144 I guess I failed to notice during the dump/restore review that this\r
145 function was (and still is until later in the series) always called with\r
146 TAG_FLAG_BE_GENEROUS. I guess that's what we want with restore;\r
147 otherwise we should warn about such tags during dump.\r
148 \r
149 >  \r
150 >       /* Decode tag. */\r
151 > -- \r
152 > 1.7.10.4\r
153 >\r
154 > _______________________________________________\r
155 > notmuch mailing list\r
156 > notmuch@notmuchmail.org\r
157 > http://notmuchmail.org/mailman/listinfo/notmuch\r