Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 5c / e8e69e656a73e27e9a6f2ec9306a83464611d8
1 Return-Path: <amdragon@mit.edu>\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 E65C1431FAF\r
6         for <notmuch@notmuchmail.org>; Fri, 26 Oct 2012 13:54:21 -0700 (PDT)\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 fqWq7snfVdtz for <notmuch@notmuchmail.org>;\r
16         Fri, 26 Oct 2012 13:54:21 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU\r
18         [18.7.68.34])\r
19         by olra.theworths.org (Postfix) with ESMTP id 60051431FAE\r
20         for <notmuch@notmuchmail.org>; Fri, 26 Oct 2012 13:54:21 -0700 (PDT)\r
21 X-AuditID: 12074422-b7f746d0000008cc-56-508af87cd561\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
23         by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 93.CB.02252.C78FA805; Fri, 26 Oct 2012 16:54:20 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q9QKsJkW014430; \r
27         Fri, 26 Oct 2012 16:54:19 -0400\r
28 Received: from drake.dyndns.org (26-4-172.dynamic.csail.mit.edu [18.26.4.172])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q9QKsFNM019236\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Fri, 26 Oct 2012 16:54:18 -0400 (EDT)\r
34 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1TRqv1-0006Sm-4F; Fri, 26 Oct 2012 16:54:15 -0400\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH 1/2] tag: Disallow adding malformed tags to messages\r
40 Date: Fri, 26 Oct 2012 16:54:12 -0400\r
41 Message-Id: <1351284853-24809-1-git-send-email-amdragon@mit.edu>\r
42 X-Mailer: git-send-email 1.7.10\r
43 X-Brightmail-Tracker:\r
44  H4sIAAAAAAAAA+NgFprJIsWRmVeSWpSXmKPExsUixCmqrVvzoyvAYOV1a4vrN2cyOzB6PFt1\r
45         izmAMYrLJiU1J7MstUjfLoEr4/PZtIJ3fBW/znQzNTDe4O5i5OSQEDCRWLvtBRuELSZx4d56\r
46         IJuLQ0hgH6PE9nnzGSGcDYwSh05PZQapEhI4xSRxcJ80RGIuo8T326dYQRJsAhoS2/YvZwSx\r
47         RQSkJXbenQ0U5+BgFlCT+NOlAhIWFnCRaJl8mQnEZhFQlXjSdxVsM6+Ag8T+WzfZIa6Ql3h6\r
48         v49tAiPvAkaGVYyyKblVurmJmTnFqcm6xcmJeXmpRbqmermZJXqpKaWbGEEhwO6itIPx50Gl\r
49         Q4wCHIxKPLw7nnQFCLEmlhVX5h5ilORgUhLlnfQdKMSXlJ9SmZFYnBFfVJqTWnyIUYKDWUmE\r
50         t+gYUI43JbGyKrUoHyYlzcGiJM57LeWmv5BAemJJanZqakFqEUxWhoNDSYJ3BshQwaLU9NSK\r
51         tMycEoQ0EwcnyHAeoOFgi3mLCxJzizPTIfKnGBWlxHk7QBICIImM0jy4XliMvmIUB3pFmLcX\r
52         pIoHGN9w3a+ABjMBDRZj7QQZXJKIkJJqYGRqfDz56KNpV47Ilibfqmmb2BWw9r1ndp2B7f60\r
53         VzlRRc4GyklCf37xNtdlC/ZInFb3SNsdJjXBOO/fGsYLb66G5m85H3yWW4ShxV95h9zUX5Pv\r
54         GvtFqYRZ35RPnbd634o3SqVuAbc8GwKCeD45F+4NXOoz/3CAysu+XfFTpNmv/FplcnzKfyWW\r
55         4oxEQy3mouJEANXW17ysAgAA\r
56 X-BeenThere: notmuch@notmuchmail.org\r
57 X-Mailman-Version: 2.1.13\r
58 Precedence: list\r
59 List-Id: "Use and development of the notmuch mail system."\r
60         <notmuch.notmuchmail.org>\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
64 List-Post: <mailto:notmuch@notmuchmail.org>\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
68 X-List-Received-Date: Fri, 26 Oct 2012 20:54:22 -0000\r
69 \r
70 This disallows adding empty tags, since nothing but confusion follows\r
71 in their wake, and disallows adding tags that begin with "-" because\r
72 they are also confusing, the tag "-" is impossible to remove using the\r
73 CLI, and because the syntax for removing such tags conflicts with long\r
74 argument syntax.\r
75 \r
76 This does not place any restrictions on what tags can be removed, as\r
77 that would make it difficult for people who have the misfortune of\r
78 already having malformed tags to remove these tags.\r
79 ---\r
80  notmuch-tag.c |   11 +++++++++++\r
81  test/tagging  |    4 ++++\r
82  2 files changed, 15 insertions(+)\r
83 \r
84 diff --git a/notmuch-tag.c b/notmuch-tag.c\r
85 index 7d18639..d15f1ed 100644\r
86 --- a/notmuch-tag.c\r
87 +++ b/notmuch-tag.c\r
88 @@ -203,6 +203,17 @@ notmuch_tag_command (void *ctx, int argc, char *argv[])\r
89             break;\r
90         }\r
91         if (argv[i][0] == '+' || argv[i][0] == '-') {\r
92 +           if (argv[i][0] == '+' && argv[i][1] == '\0') {\r
93 +               fprintf(stderr, "Error: tag names cannot be empty.\n");\r
94 +               return 1;\r
95 +           }\r
96 +           if (argv[i][0] == '+' && argv[i][1] == '-') {\r
97 +               /* This disallows adding the non-removable tag "-" and\r
98 +                * enables notmuch tag to take long options in the\r
99 +                * future. */\r
100 +               fprintf(stderr, "Error: tag names must not start with '-'.\n");\r
101 +               return 1;\r
102 +           }\r
103             tag_ops[tag_ops_count].tag = argv[i] + 1;\r
104             tag_ops[tag_ops_count].remove = (argv[i][0] == '-');\r
105             tag_ops_count++;\r
106 diff --git a/test/tagging b/test/tagging\r
107 index e4782ed..980ff92 100755\r
108 --- a/test/tagging\r
109 +++ b/test/tagging\r
110 @@ -46,4 +46,8 @@ test_expect_equal "$output" "\\r
111  thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (:\"  inbox tag1 unread)\r
112  thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag4 unread)"\r
113  \r
114 +test_expect_code 1 "Empty tag names" 'notmuch tag + One'\r
115 +\r
116 +test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One'\r
117 +\r
118  test_done\r
119 -- \r
120 1.7.10\r
121 \r