1 Return-Path: <novalazy@gmail.com>
\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 DB508431FBF
\r
6 for <notmuch@notmuchmail.org>; Fri, 29 Mar 2013 21:05:48 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 DLc2miKho1gI for <notmuch@notmuchmail.org>;
\r
17 Fri, 29 Mar 2013 21:05:47 -0700 (PDT)
\r
18 Received: from mail-pb0-f46.google.com (mail-pb0-f46.google.com
\r
19 [209.85.160.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 30559431FAE
\r
22 for <notmuch@notmuchmail.org>; Fri, 29 Mar 2013 21:05:47 -0700 (PDT)
\r
23 Received: by mail-pb0-f46.google.com with SMTP id uo1so466022pbc.19
\r
24 for <notmuch@notmuchmail.org>; Fri, 29 Mar 2013 21:05:46 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=x-received:date:message-id:from:to:cc:subject:in-reply-to
\r
27 :references:mime-version:content-type:content-disposition
\r
28 :content-transfer-encoding;
\r
29 bh=kBdJMcqN4jyHv3ofBp/QHxfPJP5r0xdID49+jxrIOUw=;
\r
30 b=U7TNoeA8azTB/KIhdBS1OXzko2m/iAnqyLBey4fhl160i2FUZUKaboqkEKLrHUeYua
\r
31 APAHCT2qIHcHAuDS0Oa2fJ9+QnkKVvg6zyxg26QXxP18/BcfSBGcSHMQZY7u8+y+Eh0j
\r
32 OCBX7Vm7o6H9XrntpbHffgvD3UddxDma19z1JDqi4ijbHLzvcb42JhWM4QSCq9aYDvEY
\r
33 Ff5ClEediXLjJCF4PEYIxVvdJ2HULjpvgCrL0abm5oMWw/kEzBFXfKoSte8TyJqXBLZl
\r
34 m4W3V3ASdPGJjJJ35ll52bKOlmZ1tzznvfdLVoxUwlfMynFBL5OXVRGTfZZvYXrZbv6w
\r
36 X-Received: by 10.66.164.41 with SMTP id yn9mr7671130pab.93.1364616346320;
\r
37 Fri, 29 Mar 2013 21:05:46 -0700 (PDT)
\r
38 Received: from localhost (215.42.233.220.static.exetel.com.au.
\r
40 by mx.google.com with ESMTPS id ve7sm5816598pab.11.2013.03.29.21.05.43
\r
41 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
42 Fri, 29 Mar 2013 21:05:45 -0700 (PDT)
\r
43 Date: Sat, 30 Mar 2013 15:05:37 +1100
\r
44 Message-ID: <20130330150537.GA1971@hili.localdomain>
\r
45 From: Peter Wang <novalazy@gmail.com>
\r
46 To: David Bremner <david@tethera.net>
\r
47 Subject: Re: [PATCH v4 06/12] test: add tests for insert
\r
48 In-Reply-To: <87d2uhiwoz.fsf@maritornes.cs.unb.ca>
\r
49 References: <1359029288-12132-1-git-send-email-novalazy@gmail.com>
\r
50 <1359029288-12132-7-git-send-email-novalazy@gmail.com>
\r
51 <87d2uhiwoz.fsf@maritornes.cs.unb.ca>
\r
53 Content-Type: text/plain; charset=utf-8
\r
54 Content-Disposition: inline
\r
55 Content-Transfer-Encoding: 8bit
\r
56 Cc: notmuch@notmuchmail.org
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Sat, 30 Mar 2013 04:05:49 -0000
\r
71 On Fri, 29 Mar 2013 19:59:56 -0400, David Bremner <david@tethera.net> wrote:
\r
73 > It took longer than I thought (of course) but I finally finished looking
\r
74 > at the first 6 patches.
\r
76 > I already mentioned a minor man page issue in a seperate message.
\r
78 > I took a second pass through 03/12, and I think I would prefer thethe
\r
79 > control flow of insert_message be closer to the standard style in
\r
80 > notmuch of using a return value variable and a single cleanup block at
\r
81 > the end. Reasonable people can disagree about issues of style, but in
\r
82 > the end consistency of the code base is also important.
\r
86 static notmuch_bool_t
\r
87 insert_message (void *ctx, notmuch_database_t *notmuch, int fdin,
\r
88 const char *dir, tag_op_list_t *tag_ops)
\r
96 fdout = maildir_open_tmp_file (ctx, dir, &tmppath, &newpath, &newdir);
\r
100 cleanup_path = tmppath;
\r
102 if (! copy_stdin (fdin, fdout))
\r
105 if (fsync (fdout) != 0) {
\r
106 fprintf (stderr, "Error: fsync failed: %s\n", strerror (errno));
\r
113 /* Atomically move the new message file from the Maildir 'tmp' directory
\r
114 * to the 'new' directory. We follow the Dovecot recommendation to
\r
115 * simply use rename() instead of link() and unlink().
\r
116 * See also: http://wiki.dovecot.org/MailboxFormat/Maildir#Mail_delivery
\r
118 if (rename (tmppath, newpath) != 0) {
\r
119 fprintf (stderr, "Error: rename() failed: %s\n", strerror (errno));
\r
123 cleanup_path = newpath;
\r
125 if (! add_file_to_database (notmuch, newpath, tag_ops)) {
\r
126 /* XXX add an option to keep the file in maildir? */
\r
130 if (! sync_dir (newdir))
\r
133 cleanup_path = NULL; /* success */
\r
139 if (cleanup_path) {
\r
140 unlink (cleanup_path);
\r