1 Return-Path: <tomi.ollila@iki.fi>
\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 D0020431FAF
\r
6 for <notmuch@notmuchmail.org>; Fri, 26 Oct 2012 14:17:41 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 t0zfboOm9qYh for <notmuch@notmuchmail.org>;
\r
16 Fri, 26 Oct 2012 14:17:41 -0700 (PDT)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 53F3E431FAE
\r
19 for <notmuch@notmuchmail.org>; Fri, 26 Oct 2012 14:17:41 -0700 (PDT)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id 72792100045;
\r
22 Sat, 27 Oct 2012 00:17:43 +0300 (EEST)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org
\r
25 Subject: Re: [PATCH 1/2] tag: Disallow adding malformed tags to messages
\r
26 In-Reply-To: <1351284853-24809-1-git-send-email-amdragon@mit.edu>
\r
27 References: <1351284853-24809-1-git-send-email-amdragon@mit.edu>
\r
28 User-Agent: Notmuch/0.14+59~gf9031cd (http://notmuchmail.org) Emacs/24.2.1
\r
29 (x86_64-unknown-linux-gnu)
\r
30 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
31 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
32 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
33 Date: Sat, 27 Oct 2012 00:17:43 +0300
\r
34 Message-ID: <m2haphue4o.fsf@guru.guru-group.fi>
\r
36 Content-Type: text/plain
\r
37 X-BeenThere: notmuch@notmuchmail.org
\r
38 X-Mailman-Version: 2.1.13
\r
40 List-Id: "Use and development of the notmuch mail system."
\r
41 <notmuch.notmuchmail.org>
\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
45 List-Post: <mailto:notmuch@notmuchmail.org>
\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
49 X-List-Received-Date: Fri, 26 Oct 2012 21:17:42 -0000
\r
51 On Fri, Oct 26 2012, Austin Clements wrote:
\r
53 > This disallows adding empty tags, since nothing but confusion follows
\r
54 > in their wake, and disallows adding tags that begin with "-" because
\r
55 > they are also confusing, the tag "-" is impossible to remove using the
\r
56 > CLI, and because the syntax for removing such tags conflicts with long
\r
59 > This does not place any restrictions on what tags can be removed, as
\r
60 > that would make it difficult for people who have the misfortune of
\r
61 > already having malformed tags to remove these tags.
\r
69 > notmuch-tag.c | 11 +++++++++++
\r
70 > test/tagging | 4 ++++
\r
71 > 2 files changed, 15 insertions(+)
\r
73 > diff --git a/notmuch-tag.c b/notmuch-tag.c
\r
74 > index 7d18639..d15f1ed 100644
\r
75 > --- a/notmuch-tag.c
\r
76 > +++ b/notmuch-tag.c
\r
77 > @@ -203,6 +203,17 @@ notmuch_tag_command (void *ctx, int argc, char *argv[])
\r
80 > if (argv[i][0] == '+' || argv[i][0] == '-') {
\r
81 > + if (argv[i][0] == '+' && argv[i][1] == '\0') {
\r
82 > + fprintf(stderr, "Error: tag names cannot be empty.\n");
\r
85 > + if (argv[i][0] == '+' && argv[i][1] == '-') {
\r
86 > + /* This disallows adding the non-removable tag "-" and
\r
87 > + * enables notmuch tag to take long options in the
\r
89 > + fprintf(stderr, "Error: tag names must not start with '-'.\n");
\r
92 > tag_ops[tag_ops_count].tag = argv[i] + 1;
\r
93 > tag_ops[tag_ops_count].remove = (argv[i][0] == '-');
\r
95 > diff --git a/test/tagging b/test/tagging
\r
96 > index e4782ed..980ff92 100755
\r
97 > --- a/test/tagging
\r
98 > +++ b/test/tagging
\r
99 > @@ -46,4 +46,8 @@ test_expect_equal "$output" "\
\r
100 > thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (:\" inbox tag1 unread)
\r
101 > thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag4 unread)"
\r
103 > +test_expect_code 1 "Empty tag names" 'notmuch tag + One'
\r
105 > +test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One'
\r
111 > _______________________________________________
\r
112 > notmuch mailing list
\r
113 > notmuch@notmuchmail.org
\r
114 > http://notmuchmail.org/mailman/listinfo/notmuch
\r