Re: [PATCH] completion: fail silently if _init_completion is not found
[notmuch-archives.git] / f9 / ccdbc96d264dff210fc3bfcc8485ec23316a8d
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 07812431FBD\r
6         for <notmuch@notmuchmail.org>; Sun, 30 Dec 2012 22:42:53 -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 EbO6ohPmdR2V for <notmuch@notmuchmail.org>;\r
16         Sun, 30 Dec 2012 22:42:52 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU\r
18         [18.9.25.15])\r
19         by olra.theworths.org (Postfix) with ESMTP id 26502431FB6\r
20         for <notmuch@notmuchmail.org>; Sun, 30 Dec 2012 22:42:52 -0800 (PST)\r
21 X-AuditID: 1209190f-b7f016d000000e07-af-50e133eb4e52\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id FB.5C.03591.BE331E05; Mon, 31 Dec 2012 01:42:51 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id qBV6gohR026113; \r
27         Mon, 31 Dec 2012 01:42:50 -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 qBV6gkFX009881\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Mon, 31 Dec 2012 01:42:49 -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 1TpZ5C-0000ij-2u; Mon, 31 Dec 2012 01:42:46 -0500\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH v4 3/5] dump: Disallow \n in message IDs\r
40 Date: Mon, 31 Dec 2012 01:42:40 -0500\r
41 Message-Id: <1356936162-2589-4-git-send-email-amdragon@mit.edu>\r
42 X-Mailer: git-send-email 1.7.10.4\r
43 In-Reply-To: <1356936162-2589-1-git-send-email-amdragon@mit.edu>\r
44 References: <1356936162-2589-1-git-send-email-amdragon@mit.edu>\r
45 X-Brightmail-Tracker:\r
46  H4sIAAAAAAAAA+NgFrrNIsWRmVeSWpSXmKPExsUixG6nrvva+GGAwf5XhhY3WrsZLZqmO1us\r
47         nstjcf3mTGaLNyvnsTqweuycdZfd4/DXhSwet+6/Zvd4tuoWs8eWQ++ZA1ijuGxSUnMyy1KL\r
48         9O0SuDKuzO9nLVguWLHr+RXmBsZbvF2MnBwSAiYSD058ZIewxSQu3FvP1sXIxSEksI9RYuqb\r
49         q6wQzgZGifcvT0BlLjJJHNu4nhnCmcso8enYOkaQfjYBDYlt+5eD2SIC0hI7784Ga2cWaGKU\r
50         uLZpLhtIQljAQmLDnx1gC1kEVCUWvHrIDGLzCthL/Fz0ihXiEEWJ7mcTwOo5BRwkdj6bxQJi\r
51         CwHV7N57nnECI/8CRoZVjLIpuVW6uYmZOcWpybrFyYl5ealFuiZ6uZkleqkppZsYQWHIKcm/\r
52         g/HbQaVDjAIcjEo8vBxMDwOEWBPLiitzDzFKcjApifIqAYNYiC8pP6UyI7E4I76oNCe1+BCj\r
53         BAezkgjvWy2gHG9KYmVValE+TEqag0VJnPdqyk1/IYH0xJLU7NTUgtQimKwMB4eSBO8GI6BG\r
54         waLU9NSKtMycEoQ0EwcnyHAeoOEfQWp4iwsSc4sz0yHypxgVpcR5n4MkBEASGaV5cL2wNPGK\r
55         URzoFWHe8yBVPMAUA9f9CmgwE9BgLYYHIINLEhFSUg2MUUJHXxYEbH3FM6fqzRqPaQvOzOGc\r
56         ceGlwypJseB5yuE/jwYXzpO2WavDJ8hWGSZxrOFkbvmDT94VDYXiIm3PP4ecXrHBllumYfbT\r
57         jYKr4iet35157Zrkq+mM1jdnzItfJtA7XY65ITH2xNGO2Fdz1bbwbAhhv21SvO/f/eAX7+/O\r
58         6Xco3BUgqsRSnJFoqMVcVJwIAD8eXB/uAgAA\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: Mon, 31 Dec 2012 06:42:53 -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       |    9 +++++++++\r
88  test/random-corpus.c |    4 +++-\r
89  2 files changed, 12 insertions(+), 1 deletion(-)\r
90 \r
91 diff --git a/notmuch-dump.c b/notmuch-dump.c\r
92 index d2dad40..29d79da 100644\r
93 --- a/notmuch-dump.c\r
94 +++ b/notmuch-dump.c\r
95 @@ -132,6 +132,15 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[])\r
96         if (output_format == DUMP_FORMAT_SUP) {\r
97             fputs (")\n", output);\r
98         } else {\r
99 +           if (strchr (message_id, '\n')) {\r
100 +               /* This will produce a line break in the output, which\r
101 +                * would be difficult to handle in tools.  However,\r
102 +                * it's also impossible to produce an email containing\r
103 +                * a line break in a message ID because of unfolding,\r
104 +                * so we can safely disallow it. */\r
105 +               fprintf (stderr, "Error: cannot dump message id containing line break: %s\n", message_id);\r
106 +               return 1;\r
107 +           }\r
108             if (hex_encode (notmuch, message_id,\r
109                             &buffer, &buffer_size) != HEX_SUCCESS) {\r
110                     fprintf (stderr, "Error: failed to hex-encode msg-id %s\n",\r
111 diff --git a/test/random-corpus.c b/test/random-corpus.c\r
112 index f354d4b..8b7748e 100644\r
113 --- a/test/random-corpus.c\r
114 +++ b/test/random-corpus.c\r
115 @@ -96,7 +96,9 @@ random_utf8_string (void *ctx, size_t char_count)\r
116             buf = talloc_realloc (ctx, buf, gchar, buf_size);\r
117         }\r
118  \r
119 -       randomchar = random_unichar ();\r
120 +       do {\r
121 +           randomchar = random_unichar ();\r
122 +       } while (randomchar == '\n');\r
123  \r
124         written = g_unichar_to_utf8 (randomchar, buf + offset);\r
125  \r
126 -- \r
127 1.7.10.4\r
128 \r