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 13AE840A95E
\r
6 for <notmuch@notmuchmail.org>; Sat, 7 Jun 2014 06:52:47 -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 eWZq-qO851Ik for <notmuch@notmuchmail.org>;
\r
16 Sat, 7 Jun 2014 06:52:39 -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 72EB540A93B
\r
19 for <notmuch@notmuchmail.org>; Sat, 7 Jun 2014 06:52:39 -0700 (PDT)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id 1A68E1000B3;
\r
22 Sat, 7 Jun 2014 16:52:35 +0300 (EEST)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org
\r
25 Subject: Re: [PATCH] lib: resurrect support for single-message mbox files
\r
26 In-Reply-To: <1401950049-22351-1-git-send-email-jani@nikula.org>
\r
27 References: <1401950049-22351-1-git-send-email-jani@nikula.org>
\r
28 User-Agent: Notmuch/0.18+28~gcecaba1 (http://notmuchmail.org) Emacs/24.3.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, 07 Jun 2014 16:52:34 +0300
\r
34 Message-ID: <m27g4sn7x9.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: Sat, 07 Jun 2014 13:52:47 -0000
\r
51 On Thu, Jun 05 2014, Jani Nikula <jani@nikula.org> wrote:
\r
53 > This is effectively a revert of
\r
55 Looks good, tests pass. I'll mark this 0.18.1 material...
\r
61 > commit 6812136bf576d894591606d9e10096719054d1f9
\r
62 > Author: Jani Nikula <jani@nikula.org>
\r
63 > Date: Mon Mar 31 00:21:48 2014 +0300
\r
65 > lib: drop support for single-message mbox files
\r
67 > The intention was to drop support for indexing new single-message mbox
\r
68 > files (and whether that was a good idea in the first place is
\r
69 > arguable). However this inadvertently broke support for reading
\r
70 > headers from previously indexed single-message mbox files, which is
\r
73 > Distinguishing between the two cases would require more code than
\r
74 > simply bringing back support for single-message mbox files.
\r
76 > lib/message-file.c | 30 +++++++++++++++++++++++++-----
\r
77 > test/T050-new.sh | 26 ++++++++++++++++----------
\r
78 > 2 files changed, 41 insertions(+), 15 deletions(-)
\r
80 > diff --git a/lib/message-file.c b/lib/message-file.c
\r
81 > index 6782882..483ba1e 100644
\r
82 > --- a/lib/message-file.c
\r
83 > +++ b/lib/message-file.c
\r
84 > @@ -117,7 +117,7 @@ notmuch_message_file_close (notmuch_message_file_t *message)
\r
87 > static notmuch_bool_t
\r
88 > -is_mbox (FILE *file)
\r
89 > +_is_mbox (FILE *file)
\r
92 > notmuch_bool_t ret = FALSE;
\r
93 > @@ -139,13 +139,12 @@ _notmuch_message_file_parse (notmuch_message_file_t *message)
\r
94 > GMimeParser *parser;
\r
95 > notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;
\r
96 > static int initialized = 0;
\r
97 > + notmuch_bool_t is_mbox;
\r
99 > if (message->message)
\r
100 > return NOTMUCH_STATUS_SUCCESS;
\r
102 > - /* We no longer support mboxes at all. */
\r
103 > - if (is_mbox (message->file))
\r
104 > - return NOTMUCH_STATUS_FILE_NOT_EMAIL;
\r
105 > + is_mbox = _is_mbox (message->file);
\r
107 > if (! initialized) {
\r
108 > g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);
\r
109 > @@ -163,7 +162,7 @@ _notmuch_message_file_parse (notmuch_message_file_t *message)
\r
110 > g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream), FALSE);
\r
112 > parser = g_mime_parser_new_with_stream (stream);
\r
113 > - g_mime_parser_set_scan_from (parser, FALSE);
\r
114 > + g_mime_parser_set_scan_from (parser, is_mbox);
\r
116 > message->message = g_mime_parser_construct_message (parser);
\r
117 > if (! message->message) {
\r
118 > @@ -171,6 +170,27 @@ _notmuch_message_file_parse (notmuch_message_file_t *message)
\r
123 > + if (! g_mime_parser_eos (parser)) {
\r
124 > + /* This is a multi-message mbox. */
\r
125 > + status = NOTMUCH_STATUS_FILE_NOT_EMAIL;
\r
129 > + * For historical reasons, we support single-message mboxes,
\r
130 > + * but this behavior is likely to change in the future, so
\r
133 > + static notmuch_bool_t mbox_warning = FALSE;
\r
134 > + if (! mbox_warning) {
\r
135 > + mbox_warning = TRUE;
\r
136 > + fprintf (stderr, "\
\r
137 > +Warning: %s is an mbox containing a single message,\n\
\r
138 > +likely caused by misconfigured mail delivery. Support for single-message\n\
\r
139 > +mboxes is deprecated and may be removed in the future.\n", message->filename);
\r
144 > g_object_unref (stream);
\r
145 > g_object_unref (parser);
\r
146 > diff --git a/test/T050-new.sh b/test/T050-new.sh
\r
147 > index 3c31954..ad46ee6 100755
\r
148 > --- a/test/T050-new.sh
\r
149 > +++ b/test/T050-new.sh
\r
150 > @@ -163,6 +163,22 @@ rm -rf "${MAIL_DIR}"/two
\r
151 > output=$(NOTMUCH_NEW)
\r
152 > test_expect_equal "$output" "No new mail. Removed 3 messages."
\r
154 > +test_begin_subtest "Support single-message mbox (deprecated)"
\r
155 > +cat > "${MAIL_DIR}"/mbox_file1 <<EOF
\r
156 > +From test_suite@notmuchmail.org Fri Jan 5 15:43:57 2001
\r
157 > +From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
158 > +To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
159 > +Subject: Test mbox message 1
\r
163 > +output=$(NOTMUCH_NEW 2>&1)
\r
164 > +test_expect_equal "$output" \
\r
165 > +"Warning: ${MAIL_DIR}/mbox_file1 is an mbox containing a single message,
\r
166 > +likely caused by misconfigured mail delivery. Support for single-message
\r
167 > +mboxes is deprecated and may be removed in the future.
\r
168 > +Added 1 new message to the database."
\r
170 > # This test requires that notmuch new has been run at least once.
\r
171 > test_begin_subtest "Skip and report non-mail files"
\r
173 > @@ -184,24 +200,14 @@ Subject: Test mbox message 2
\r
177 > -cat > "${MAIL_DIR}"/mbox_file1 <<EOF
\r
178 > -From test_suite@notmuchmail.org Fri Jan 5 15:43:57 2001
\r
179 > -From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
180 > -To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
181 > -Subject: Test mbox message 1
\r
185 > output=$(NOTMUCH_NEW 2>&1)
\r
186 > test_expect_equal "$output" \
\r
187 > "Note: Ignoring non-mail file: ${MAIL_DIR}/.git/config
\r
188 > Note: Ignoring non-mail file: ${MAIL_DIR}/.ignored_hidden_file
\r
189 > Note: Ignoring non-mail file: ${MAIL_DIR}/ignored_file
\r
190 > Note: Ignoring non-mail file: ${MAIL_DIR}/mbox_file
\r
191 > -Note: Ignoring non-mail file: ${MAIL_DIR}/mbox_file1
\r
192 > Added 1 new message to the database."
\r
193 > rm "${MAIL_DIR}"/mbox_file
\r
194 > -rm "${MAIL_DIR}"/mbox_file1
\r
196 > test_begin_subtest "Ignore files and directories specified in new.ignore"
\r
201 > _______________________________________________
\r
202 > notmuch mailing list
\r
203 > notmuch@notmuchmail.org
\r
204 > http://notmuchmail.org/mailman/listinfo/notmuch
\r