Re: [PATCH v4 01/16] add util/search-path.{c, h} to test for executables in $PATH
[notmuch-archives.git] / c2 / 54d0d12a7584438835772938697dcd2cc73704
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 1F924431FB6\r
6         for <notmuch@notmuchmail.org>; Sun, 23 Jun 2013 05:20:00 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \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 TgnN++6RnrOF for <notmuch@notmuchmail.org>;\r
17         Sun, 23 Jun 2013 05:19:51 -0700 (PDT)\r
18 Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com\r
19         [209.85.220.41]) (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 2F58B431FAE\r
22         for <notmuch@notmuchmail.org>; Sun, 23 Jun 2013 05:19:51 -0700 (PDT)\r
23 Received: by mail-pa0-f41.google.com with SMTP id bj3so9838371pad.0\r
24         for <notmuch@notmuchmail.org>; Sun, 23 Jun 2013 05:19:50 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
26         h=date:message-id:from:to:cc:subject:in-reply-to:references\r
27         :mime-version:content-type:content-disposition\r
28         :content-transfer-encoding;\r
29         bh=ZW6UzJMwrRRJSXPcRbbiWxrZ+/TepwD+4SVexBmvwQQ=;\r
30         b=qINvEgDsn5Ss7pmOy2YbNEETI3t+L2MuEt8sNB2Oam3/BlvMXtpUqKz88F7ZlTUbbt\r
31         fT3pdIcw9amIjFoBJz0tcsxgGycAi0vEJABBz4NPaARtilglz6iQ1oMNx3tv08k+Ad2W\r
32         8iN++1zrWhbbqKbdX0O1Xem+wOmNI44dGgHIrEKn6OkbB5k2dv4zBVfLuUs6J6dmzy7I\r
33         WvJAxOGszZf15AGnW8f81acq0jOFQIt5PxlpX/8oM+fC0xJSI/IZaZY/Os5egT8DqbgR\r
34         aOPgczQ2lHGF/LVAFZHglYldfAIrygdp2PM2wtpOXrsKli4jFUrDEz4rAdeQWI3xM+dM\r
35         w48Q==\r
36 X-Received: by 10.66.160.97 with SMTP id xj1mr12932797pab.5.1371989988343;\r
37         Sun, 23 Jun 2013 05:19:48 -0700 (PDT)\r
38 Received: from localhost (215.42.233.220.static.exetel.com.au.\r
39         [220.233.42.215])\r
40         by mx.google.com with ESMTPSA id ri8sm13336924pbc.3.2013.06.23.05.19.45\r
41         for <multiple recipients>\r
42         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
43         Sun, 23 Jun 2013 05:19:47 -0700 (PDT)\r
44 Date: Sun, 23 Jun 2013 22:19:42 +1000\r
45 Message-ID: <20130623221942.GA18938@hili.localdomain>\r
46 From: Peter Wang <novalazy@gmail.com>\r
47 To: Mark Walters <markwalters1009@gmail.com>\r
48 Subject: Re: [PATCH v7 03/12] cli: add insert command\r
49 In-Reply-To: <8761x5uy3a.fsf@qmul.ac.uk>\r
50 References: <1371961445-15182-1-git-send-email-novalazy@gmail.com>\r
51         <1371961445-15182-4-git-send-email-novalazy@gmail.com>\r
52         <8761x5uy3a.fsf@qmul.ac.uk>\r
53 MIME-Version: 1.0\r
54 Content-Type: text/plain; charset=utf-8\r
55 Content-Disposition: inline\r
56 Content-Transfer-Encoding: 8bit\r
57 Cc: notmuch@notmuchmail.org\r
58 X-BeenThere: notmuch@notmuchmail.org\r
59 X-Mailman-Version: 2.1.13\r
60 Precedence: list\r
61 List-Id: "Use and development of the notmuch mail system."\r
62         <notmuch.notmuchmail.org>\r
63 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
65 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
66 List-Post: <mailto:notmuch@notmuchmail.org>\r
67 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
68 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
69         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
70 X-List-Received-Date: Sun, 23 Jun 2013 12:20:00 -0000\r
71 \r
72 On Sun, 23 Jun 2013 07:42:49 +0100, Mark Walters <markwalters1009@gmail.com> wrote:\r
73\r
74 > This is a +1 modulo one small bug (I think) I found below. I am happy to\r
75 > delay the fail-on-index-fail option, especially as that will need some\r
76 > bikeshedding on its name.\r
77\r
78 > Also when posting new versions please include a diff from the previous\r
79 > version (this is more difficult if there was significant rebasing). This\r
80 > makew the v6 to v7 change obvious (the one comment change and the\r
81 > bugfix).\r
82\r
83 > Moreover doing the diff with v4 (which I happen to have locally) I\r
84 > found the bug below.\r
85\r
86 > Best wishes\r
87\r
88 > Mark\r
89\r
90\r
91\r
92 ...\r
93 > > +static notmuch_bool_t\r
94 > > +insert_message (void *ctx, notmuch_database_t *notmuch, int fdin,\r
95 > > +           const char *dir, tag_op_list_t *tag_ops)\r
96 > > +{\r
97 > > +    char *tmppath;\r
98 > > +    char *newpath;\r
99 > > +    char *newdir;\r
100 > > +    int fdout;\r
101 > > +    char *cleanup_path;\r
102 > > +\r
103 > > +    fdout = maildir_open_tmp_file (ctx, dir, &tmppath, &newpath, &newdir);\r
104 > > +    if (fdout < 0)\r
105 > > +   return FALSE;\r
106 > > +\r
107 > > +    cleanup_path = tmppath;\r
108 > > +\r
109 > > +    if (! copy_stdin (fdin, fdout))\r
110 > > +   goto FAIL;\r
111 > > +\r
112 > > +    if (fsync (fdout) != 0) {\r
113 > > +   fprintf (stderr, "Error: fsync failed: %s\n", strerror (errno));\r
114 > > +   goto FAIL;\r
115 > > +    }\r
116 > > +\r
117 > > +    close (fdout);\r
118 > > +    fdout = -1;\r
119 > > +\r
120 > > +    /* Atomically move the new message file from the Maildir 'tmp' directory\r
121 > > +     * to the 'new' directory.  We follow the Dovecot recommendation to\r
122 > > +     * simply use rename() instead of link() and unlink().\r
123 > > +     * See also: http://wiki.dovecot.org/MailboxFormat/Maildir#Mail_delivery\r
124 > > +     */\r
125 > > +    if (rename (tmppath, newpath) != 0) {\r
126 > > +   fprintf (stderr, "Error: rename() failed: %s\n", strerror (errno));\r
127 > > +   goto FAIL;\r
128 > > +    }\r
129 > > +\r
130 > > +    if (! sync_dir (newdir))\r
131 > > +   goto FAIL;\r
132\r
133 > I think cleanup_path needs to be updated before the sync_dir is test as\r
134 > newpath should be unlinked rather than oldpath. (v4 explicitly unlinked newpath)\r
135\r
136 \r
137 Thanks for the continued close review.\r
138 I'll post a followup to this specific patch.\r
139 \r
140 Peter\r