1 Return-Path: <m.walters@qmul.ac.uk>
\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 8FD90431FC0
\r
6 for <notmuch@notmuchmail.org>; Mon, 19 Nov 2012 05:49:19 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5
\r
12 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,
\r
13 NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id OuKFUkF8F2Tt for <notmuch@notmuchmail.org>;
\r
17 Mon, 19 Nov 2012 05:49:18 -0800 (PST)
\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 83905431FBC
\r
22 for <notmuch@notmuchmail.org>; Mon, 19 Nov 2012 05:49:18 -0800 (PST)
\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])
\r
24 by mail2.qmul.ac.uk with esmtp (Exim 4.71)
\r
25 (envelope-from <m.walters@qmul.ac.uk>)
\r
26 id 1TaRil-0001PR-Lr; Mon, 19 Nov 2012 13:49:12 +0000
\r
27 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)
\r
28 by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)
\r
29 (envelope-from <m.walters@qmul.ac.uk>)
\r
30 id 1TaRil-00075M-Be; Mon, 19 Nov 2012 13:49:07 +0000
\r
31 From: Mark Walters <markwalters1009@gmail.com>
\r
32 To: Peter Wang <novalazy@gmail.com>
\r
33 Subject: Re: [PATCH 05/18] insert: move file from Maildir tmp to new
\r
34 In-Reply-To: <20121119232651.GB2063@hili.localdomain>
\r
35 References: <1343223767-9812-1-git-send-email-novalazy@gmail.com>
\r
36 <1343223767-9812-5-git-send-email-novalazy@gmail.com>
\r
37 <87haomq0hx.fsf@qmul.ac.uk>
\r
38 <20121119232651.GB2063@hili.localdomain>
\r
39 User-Agent: Notmuch/0.14+81~g9730584 (http://notmuchmail.org) Emacs/23.4.1
\r
40 (x86_64-pc-linux-gnu)
\r
41 Date: Mon, 19 Nov 2012 13:49:05 +0000
\r
42 Message-ID: <874nklpusu.fsf@qmul.ac.uk>
\r
44 Content-Type: text/plain; charset=us-ascii
\r
45 X-Sender-Host-Address: 93.97.24.31
\r
46 X-QM-SPAM-Info: Sender has good ham record. :)
\r
47 X-QM-Body-MD5: 59b428e578dce949411df32e677a0de0 (of first 20000 bytes)
\r
48 X-SpamAssassin-Score: -1.8
\r
49 X-SpamAssassin-SpamBar: -
\r
50 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
52 spam. We require at least 5.0 points to mark a message as spam.
\r
53 This message scored -1.8 points.
\r
54 Summary of the scoring:
\r
55 * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,
\r
57 * [138.37.6.40 listed in list.dnswl.org]
\r
58 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
59 provider * (markwalters1009[at]gmail.com)
\r
60 * 0.5 AWL AWL: From: address is in the auto white-list
\r
61 X-QM-Scan-Virus: ClamAV says the message is clean
\r
62 Cc: notmuch@notmuchmail.org
\r
63 X-BeenThere: notmuch@notmuchmail.org
\r
64 X-Mailman-Version: 2.1.13
\r
66 List-Id: "Use and development of the notmuch mail system."
\r
67 <notmuch.notmuchmail.org>
\r
68 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
69 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
70 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
71 List-Post: <mailto:notmuch@notmuchmail.org>
\r
72 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
73 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
74 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
75 X-List-Received-Date: Mon, 19 Nov 2012 13:49:19 -0000
\r
80 On Mon, 19 Nov 2012, Peter Wang <novalazy@gmail.com> wrote:
\r
81 > On Sun, 18 Nov 2012 17:33:46 +0000, Mark Walters <markwalters1009@gmail.com> wrote:
\r
82 >> On Wed, 25 Jul 2012, Peter Wang <novalazy@gmail.com> wrote:
\r
83 >> > Atomically move the new message file from the Maildir 'tmp' directory
\r
86 >> > notmuch-insert.c | 18 ++++++++++++++++++
\r
87 >> > 1 files changed, 18 insertions(+), 0 deletions(-)
\r
89 >> > diff --git a/notmuch-insert.c b/notmuch-insert.c
\r
90 >> > index 340f7e4..bab1fed 100644
\r
91 >> > --- a/notmuch-insert.c
\r
92 >> > +++ b/notmuch-insert.c
\r
93 >> > @@ -75,6 +75,20 @@ maildir_open_tmp (void *ctx, const char *dir, char **tmppath, char **newpath)
\r
96 >> > static notmuch_bool_t
\r
97 >> > +maildir_move_to_new (const char *tmppath, const char *newpath)
\r
99 >> > + /* We follow the Dovecot recommendation to simply use rename()
\r
100 >> > + * instead of link() and unlink().
\r
102 >> > + if (rename (tmppath, newpath) == 0) {
\r
103 >> > + return TRUE;
\r
106 >> Do we want to overwrite an existing message with this name? As far as I
\r
107 >> can see rename does overwrite and link would not: was that why rename is
\r
108 >> better than link/unlink?
\r
110 >> I would prefer not to overwrite but maybe there is a reason we need to.
\r
111 >> Would a possible alternative be to loop when finding a tmp file until
\r
112 >> both the tmp file and the new file do not exist?
\r
114 > According to [1] it's all pointless -- just generate unique file names.
\r
116 > The dovecot maildir-save.c has this comment:
\r
118 > /* maildir spec says we should use link() + unlink() here. however
\r
119 > since our filename is guaranteed to be unique, rename() works just
\r
120 > as well, except faster. even if the filename wasn't unique, the
\r
121 > problem could still happen if the file was already moved from
\r
122 > new/ to cur/, so link() doesn't really provide any safety anyway.
\r
124 > Besides the small temporary performance benefits, this rename() is
\r
125 > almost required with OSX's HFS+ filesystem, since it implements
\r
126 > hard links in a pretty ugly way, which makes the performance crawl
\r
127 > when a lot of hard links are used. */
\r
129 > Well, that's one point of view. I can't say I know any better.
\r
131 I think I agree with you/them. Indeed, since files in cur can have
\r
132 maildir flags we could find that this rename works but then the new file
\r
133 gets stomped on by notmuch_message_tags_to_maildir_flags which also uses
\r
134 rename. It might be work adding the link to [1] in the comment, but in
\r
135 any case I am happy with this now.
\r
144 > [1]: http://wiki.dovecot.org/MailboxFormat/Maildir#Mail_delivery
\r