Re: Avoiding the "huge INBOX of death"
[notmuch-archives.git] / dc / d3ebfb36ea1690f3fe96b7f8cd2b8e6e163947
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 7DA8F431FBC\r
6         for <notmuch@notmuchmail.org>; Thu, 13 Dec 2012 14:07:38 -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: -1.098\r
10 X-Spam-Level: \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 4o2c+Vw3a0TM for <notmuch@notmuchmail.org>;\r
17         Thu, 13 Dec 2012 14:07:38 -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 C0A70431FB6\r
22         for <notmuch@notmuchmail.org>; Thu, 13 Dec 2012 14:07:37 -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 1TjGwF-0003Wm-7C; Thu, 13 Dec 2012 22:07:33 +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 1TjGwE-0005vV-UR; Thu, 13 Dec 2012 22:07:31 +0000\r
31 From: Mark Walters <markwalters1009@gmail.com>\r
32 To: david@tethera.net, notmuch@notmuchmail.org\r
33 Subject: Re: [Patch v6 1/6] tag-util: factor out rules for illegal tags,\r
34         use in parse_tag_line\r
35 In-Reply-To: <1355096008-4544-2-git-send-email-david@tethera.net>\r
36 References: <1355096008-4544-1-git-send-email-david@tethera.net>\r
37         <1355096008-4544-2-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: Thu, 13 Dec 2012 22:07:32 +0000\r
41 Message-ID: <871uettxln.fsf@qmul.ac.uk>\r
42 MIME-Version: 1.0\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: 58d2b61d88fae9d87e3bd6eab48cee79 (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
50         determine if it is\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
55         *      medium trust\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
64 Precedence: list\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: Thu, 13 Dec 2012 22:07:38 -0000\r
75 \r
76 \r
77 I don't know if this matters but it seems that one can still add a "-"\r
78 tag by doing something like\r
79 \r
80 echo "+%2d -- search" | notmuch tag --batch\r
81 \r
82 This might be the right thing to do but I thought I would mention it.\r
83 \r
84 Best wishes\r
85 \r
86 Mark\r
87 \r
88 On Sun, 09 Dec 2012, david@tethera.net wrote:\r
89 > From: David Bremner <bremner@debian.org>\r
90 >\r
91 > This will allow us to be consistent between batch tagging and command\r
92 > line tagging as far as what is an illegal tag.\r
93 > ---\r
94 >  tag-util.c |   35 ++++++++++++++++++++++++++++++-----\r
95 >  1 file changed, 30 insertions(+), 5 deletions(-)\r
96 >\r
97 > diff --git a/tag-util.c b/tag-util.c\r
98 > index eab482f..c071ea8 100644\r
99 > --- a/tag-util.c\r
100 > +++ b/tag-util.c\r
101 > @@ -31,6 +31,29 @@ line_error (tag_parse_status_t status,\r
102 >      return status;\r
103 >  }\r
104 >  \r
105 > +/*\r
106 > + * Test tags for some forbidden cases.\r
107 > + *\r
108 > + * return: NULL if OK,\r
109 > + *      explanatory message otherwise.\r
110 > + */\r
111 > +\r
112 > +static const char *\r
113 > +illegal_tag (const char *tag, notmuch_bool_t remove) {\r
114 > +\r
115 > +    if (*tag == '\0' && !remove)\r
116 > +     return "adding empty tag";\r
117 > +\r
118 > +    /* This disallows adding the non-removable tag "-" and\r
119 > +     * enables notmuch tag to take long options more easily.\r
120 > +     */\r
121 > +\r
122 > +    if (*tag == '-' && !remove)\r
123 > +     return  "adding tag starting with -";\r
124 > +\r
125 > +    return NULL;\r
126 > +}\r
127 > +\r
128 >  tag_parse_status_t\r
129 >  parse_tag_line (void *ctx, char *line,\r
130 >               tag_op_flag_t flags,\r
131 > @@ -95,11 +118,13 @@ parse_tag_line (void *ctx, char *line,\r
132 >       remove = (*tok == '-');\r
133 >       tag = tok + 1;\r
134 >  \r
135 > -     /* Maybe refuse empty tags. */\r
136 > -     if (! (flags & TAG_FLAG_BE_GENEROUS) && *tag == '\0') {\r
137 > -         ret = line_error (TAG_PARSE_INVALID, line_for_error,\r
138 > -                           "empty tag");\r
139 > -         goto DONE;\r
140 > +     /* Maybe refuse illegal tags. */\r
141 > +     if (! (flags & TAG_FLAG_BE_GENEROUS)) {\r
142 > +         const char *msg = illegal_tag (tag, remove);\r
143 > +         if (msg) {\r
144 > +             ret = line_error (TAG_PARSE_INVALID, line_for_error, msg);\r
145 > +             goto DONE;\r
146 > +         }\r
147 >       }\r
148 >  \r
149 >       /* Decode tag. */\r
150 > -- \r
151 > 1.7.10.4\r
152 >\r
153 > _______________________________________________\r
154 > notmuch mailing list\r
155 > notmuch@notmuchmail.org\r
156 > http://notmuchmail.org/mailman/listinfo/notmuch\r