Re: [PATCH v2] Omit User-Agent: header by default
[notmuch-archives.git] / bf / f76a79fbc2277a03872dac51d1e544719c26ee
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 96349431FDC\r
6         for <notmuch@notmuchmail.org>; Sun,  6 Jan 2013 12:23:14 -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 eWvGPSbW8JwR for <notmuch@notmuchmail.org>;\r
16         Sun,  6 Jan 2013 12:23:14 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU\r
18         [18.7.68.35])\r
19         by olra.theworths.org (Postfix) with ESMTP id D0189431FBF\r
20         for <notmuch@notmuchmail.org>; Sun,  6 Jan 2013 12:23:13 -0800 (PST)\r
21 X-AuditID: 12074423-b7ef96d000000725-23-50e9dd31753a\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
23         by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 27.D1.01829.13DD9E05; Sun,  6 Jan 2013 15:23:13 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id r06KNBfY002905; \r
27         Sun, 6 Jan 2013 15:23:11 -0500\r
28 Received: from drake.dyndns.org (a069.catapulsion.net [70.36.81.69])\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 r06KMvMj020351\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Sun, 6 Jan 2013 15:23:09 -0500 (EST)\r
34 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1Trwk7-0007YH-LX; Sun, 06 Jan 2013 15:22:51 -0500\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH v5 4/6] dump: Disallow \n in message IDs\r
40 Date: Sun,  6 Jan 2013 15:22:40 -0500\r
41 Message-Id: <1357503762-28759-5-git-send-email-amdragon@mit.edu>\r
42 X-Mailer: git-send-email 1.7.10.4\r
43 In-Reply-To: <1357503762-28759-1-git-send-email-amdragon@mit.edu>\r
44 References: <1357503762-28759-1-git-send-email-amdragon@mit.edu>\r
45 X-Brightmail-Tracker:\r
46  H4sIAAAAAAAAA+NgFrrFIsWRmVeSWpSXmKPExsUixG6nomt492WAweJPahY3WrsZLZqmO1us\r
47         nstjcf3mTGaLNyvnsTqweuycdZfd4/DXhSwet+6/Zvd4tuoWs8eWQ++ZA1ijuGxSUnMyy1KL\r
48         9O0SuDKWbDvEUvBSsOLbtLnMDYzT+LoYOTkkBEwkFv85zwxhi0lcuLeerYuRi0NIYB+jxIwj\r
49         JxkhnPWMEvMvvYfK7GeSuNzczQThzGWU2HJzGwtIP5uAhsS2/csZQWwRAWmJnXdns4IUMQs0\r
50         MUpc2zSXDSQhLGAhcebiGyYQm0VAVeL0s/1gDbwCDhLdH1vZIQ5RlOh+NgGonoODU8BR4uM8\r
51         WZCwEFDJnR332Scw8i9gZFjFKJuSW6Wbm5iZU5yarFucnJiXl1qka6aXm1mil5pSuokRHIQu\r
52         yjsY/xxUOsQowMGoxMN7YeeLACHWxLLiytxDjJIcTEqivLsvvgwQ4kvKT6nMSCzOiC8qzUkt\r
53         PsQowcGsJMK77xhQjjclsbIqtSgfJiXNwaIkznst5aa/kEB6YklqdmpqQWoRTFaGg0NJglfy\r
54         DlCjYFFqempFWmZOCUKaiYMTZDgP0PCXt0GGFxck5hZnpkPkTzEqSonzyoA0C4AkMkrz4Hph\r
55         SeIVozjQK8K8BiBVPMAEA9f9CmgwE9Dg1MfPQQaXJCKkpBoYs9cw+R4/ssvfZVJ0jur53KvK\r
56         Tzvaz+buKotd9PvUqtNf2hnPXws4oOWqVXt++sTlN3852+z9cih5Ve77iafPSJ63mz1J+IP6\r
57         makxE5IXeN4+/Toz56LI8fp161aYfn6/zqdm52WNmjIGxWcXLvH3PuG91te+umzi3836V03X\r
58         KemLWqedi+B1XqzEUpyRaKjFXFScCACVouas7QIAAA==\r
59 Cc: tomi.ollila@iki.fi\r
60 X-BeenThere: notmuch@notmuchmail.org\r
61 X-Mailman-Version: 2.1.13\r
62 Precedence: list\r
63 List-Id: "Use and development of the notmuch mail system."\r
64         <notmuch.notmuchmail.org>\r
65 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
66         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
67 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
68 List-Post: <mailto:notmuch@notmuchmail.org>\r
69 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
70 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
72 X-List-Received-Date: Sun, 06 Jan 2013 20:23:14 -0000\r
73 \r
74 When we switch to using regular Xapian queries in the dump format, \n\r
75 will cause problems, so we disallow it.  Specially, while Xapian can\r
76 quote and parse queries containing \n without difficultly, quoted\r
77 queries containing \n still span multiple lines, which breaks the\r
78 line-orientedness of the dump format.  Strictly speaking, we could\r
79 still round-trip these, but it would significantly complicate restore\r
80 as well as scripts that deal with tag dumps.  This complexity would\r
81 come at absolutely no benefit: because of the RFC 2822 unfolding\r
82 rules, no amount of standards negligence can produce a message with a\r
83 message ID containing a line break (not even Outlook can do it!).\r
84 \r
85 Hence, we simply disallow it.\r
86 ---\r
87  notmuch-dump.c       |   12 ++++++++++++\r
88  test/random-corpus.c |    4 +++-\r
89  2 files changed, 15 insertions(+), 1 deletion(-)\r
90 \r
91 diff --git a/notmuch-dump.c b/notmuch-dump.c\r
92 index d2dad40..5bbda36 100644\r
93 --- a/notmuch-dump.c\r
94 +++ b/notmuch-dump.c\r
95 @@ -102,6 +102,18 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[])\r
96         message = notmuch_messages_get (messages);\r
97         message_id = notmuch_message_get_message_id (message);\r
98  \r
99 +       if (output_format == DUMP_FORMAT_BATCH_TAG &&\r
100 +           strchr (message_id, '\n')) {\r
101 +           /* This will produce a line break in the output, which\r
102 +            * would be difficult to handle in tools.  However, it's\r
103 +            * also impossible to produce an email containing a line\r
104 +            * break in a message ID because of unfolding, so we can\r
105 +            * safely disallow it. */\r
106 +           fprintf (stderr, "Warning: skipping message id containing line break: \"%s\"\n", message_id);\r
107 +           notmuch_message_destroy (message);\r
108 +           continue;\r
109 +       }\r
110 +\r
111         if (output_format == DUMP_FORMAT_SUP) {\r
112             fprintf (output, "%s (", message_id);\r
113         }\r
114 diff --git a/test/random-corpus.c b/test/random-corpus.c\r
115 index f354d4b..8b7748e 100644\r
116 --- a/test/random-corpus.c\r
117 +++ b/test/random-corpus.c\r
118 @@ -96,7 +96,9 @@ random_utf8_string (void *ctx, size_t char_count)\r
119             buf = talloc_realloc (ctx, buf, gchar, buf_size);\r
120         }\r
121  \r
122 -       randomchar = random_unichar ();\r
123 +       do {\r
124 +           randomchar = random_unichar ();\r
125 +       } while (randomchar == '\n');\r
126  \r
127         written = g_unichar_to_utf8 (randomchar, buf + offset);\r
128  \r
129 -- \r
130 1.7.10.4\r
131 \r