Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 76 / 13f5482fda89b6b614990bec2138566617564a
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 2318F431FC3\r
6         for <notmuch@notmuchmail.org>; Tue, 25 Dec 2012 19:49:03 -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 rU5YGJNLa-m7 for <notmuch@notmuchmail.org>;\r
16         Tue, 25 Dec 2012 19:49:00 -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 E8F1F431FB6\r
20         for <notmuch@notmuchmail.org>; Tue, 25 Dec 2012 19:48:58 -0800 (PST)\r
21 X-AuditID: 12074423-b7ef96d000000725-d7-50da73aaa6d1\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 35.24.01829.AA37AD05; Tue, 25 Dec 2012 22:48:58 -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 qBQ3mvbZ031278; \r
27         Tue, 25 Dec 2012 22:48:57 -0500\r
28 Received: from drake.dyndns.org (c-76-21-105-205.hsd1.ca.comcast.net\r
29         [76.21.105.205]) (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 qBQ3mrna013183\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Tue, 25 Dec 2012 22:48:55 -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 1Tnhz8-0002z0-RX; Tue, 25 Dec 2012 22:48:50 -0500\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH v2 3/5] dump: Disallow \n in message IDs\r
40 Date: Tue, 25 Dec 2012 22:48:41 -0500\r
41 Message-Id: <1356493723-11085-4-git-send-email-amdragon@mit.edu>\r
42 X-Mailer: git-send-email 1.7.10.4\r
43 In-Reply-To: <1356493723-11085-1-git-send-email-amdragon@mit.edu>\r
44 References: <1356493723-11085-1-git-send-email-amdragon@mit.edu>\r
45 X-Brightmail-Tracker:\r
46  H4sIAAAAAAAAA+NgFjrLIsWRmVeSWpSXmKPExsUixG6noruq+FaAQetMMYsbrd2MFk3TnS1W\r
47         z+WxuH5zJrMDi8fOWXfZPW7df83u8WzVLWaPLYfeMwewRHHZpKTmZJalFunbJXBlXJnfz1qw\r
48         XLBi1/MrzA2Mt3i7GDk5JARMJH7en8cMYYtJXLi3ng3EFhLYxyix+bdhFyMXkL2BUeLU9HZG\r
49         COcik8SCE73MEFVzGSWetSaC2GwCGhLb9i9nBLFFBKQldt6dzQpiMwvkSTx8tJUdxBYWsJBo\r
50         nv4PbAOLgKrEvZdHwWxeAQeJbec/sENcoSjR/WwCUJyDg1PAUWLngzqIVQ4SEx+eZ5rAyL+A\r
51         kWEVo2xKbpVubmJmTnFqsm5xcmJeXmqRrplebmaJXmpK6SZGcKi5KO9g/HNQ6RCjAAejEg8v\r
52         x6+bAUKsiWXFlbmHGCU5mJREebcX3AoQ4kvKT6nMSCzOiC8qzUktPsQowcGsJMLr/BGonDcl\r
53         sbIqtSgfJiXNwaIkznst5aa/kEB6YklqdmpqQWoRTFaGg0NJglcHGFNCgkWp6akVaZk5JQhp\r
54         Jg5OkOE8QMPFQGp4iwsSc4sz0yHypxgVpcR5pUESAiCJjNI8uF5YKnjFKA70ijDvryKgKh5g\r
55         GoHrfgU0mAlocCzfDZDBJYkIKakGRuYs9mbDx1+7b/dN5FynedBE7g8zy3uP5ix2Lq6Sb0zn\r
56         XWUfX7C/MK1MVUnxjcXcvjN5DO6+c9vOeGWIrNjJYPg72dVoxV+bygQZIe9NvxWu/ahb9LWm\r
57         x9pjfs9LwWUzZQLYJKfW9rxmfLw36cD6s/VSqhXzM8r4/ibMrV0nbLlmy6p/K3njlViKMxIN\r
58         tZiLihMB5LZFd+ACAAA=\r
59 X-BeenThere: notmuch@notmuchmail.org\r
60 X-Mailman-Version: 2.1.13\r
61 Precedence: list\r
62 List-Id: "Use and development of the notmuch mail system."\r
63         <notmuch.notmuchmail.org>\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
67 List-Post: <mailto:notmuch@notmuchmail.org>\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
71 X-List-Received-Date: Wed, 26 Dec 2012 03:49:04 -0000\r
72 \r
73 When we switch to using regular Xapian queries in the dump format, \n\r
74 will cause problems, so we disallow it.  Specially, while Xapian can\r
75 quote and parse queries containing \n without difficultly, quoted\r
76 queries containing \n still span multiple lines, which breaks the\r
77 line-orientedness of the dump format.  Strictly speaking, we could\r
78 still round-trip these, but it would significantly complicate restore\r
79 as well as scripts that deal with tag dumps.  This complexity would\r
80 come at absolutely no benefit: because of the RFC 2822 unfolding\r
81 rules, no amount of standards negligence can produce a message with a\r
82 message ID containing a line break (not even Outlook can do it!).\r
83 \r
84 Hence, we simply disallow it.\r
85 ---\r
86  notmuch-dump.c       |    9 +++++++++\r
87  test/random-corpus.c |    4 +++-\r
88  2 files changed, 12 insertions(+), 1 deletion(-)\r
89 \r
90 diff --git a/notmuch-dump.c b/notmuch-dump.c\r
91 index d2dad40..29d79da 100644\r
92 --- a/notmuch-dump.c\r
93 +++ b/notmuch-dump.c\r
94 @@ -132,6 +132,15 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[])\r
95         if (output_format == DUMP_FORMAT_SUP) {\r
96             fputs (")\n", output);\r
97         } else {\r
98 +           if (strchr (message_id, '\n')) {\r
99 +               /* This will produce a line break in the output, which\r
100 +                * would be difficult to handle in tools.  However,\r
101 +                * it's also impossible to produce an email containing\r
102 +                * a line break in a message ID because of unfolding,\r
103 +                * so we can safely disallow it. */\r
104 +               fprintf (stderr, "Error: cannot dump message id containing line break: %s\n", message_id);\r
105 +               return 1;\r
106 +           }\r
107             if (hex_encode (notmuch, message_id,\r
108                             &buffer, &buffer_size) != HEX_SUCCESS) {\r
109                     fprintf (stderr, "Error: failed to hex-encode msg-id %s\n",\r
110 diff --git a/test/random-corpus.c b/test/random-corpus.c\r
111 index f354d4b..8b7748e 100644\r
112 --- a/test/random-corpus.c\r
113 +++ b/test/random-corpus.c\r
114 @@ -96,7 +96,9 @@ random_utf8_string (void *ctx, size_t char_count)\r
115             buf = talloc_realloc (ctx, buf, gchar, buf_size);\r
116         }\r
117  \r
118 -       randomchar = random_unichar ();\r
119 +       do {\r
120 +           randomchar = random_unichar ();\r
121 +       } while (randomchar == '\n');\r
122  \r
123         written = g_unichar_to_utf8 (randomchar, buf + offset);\r
124  \r
125 -- \r
126 1.7.10.4\r
127 \r