notmuch and "mute" -- useful to anyone?
[notmuch-archives.git] / 06 / b2ef080ae71ac108fbf58b28afa58ea780b235
1 Return-Path: <ciprian.craciun@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 7E0BE40DEE1\r
6         for <notmuch@notmuchmail.org>; Tue, 16 Nov 2010 14:16:48 -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: -1.999\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5\r
12         tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,\r
13         DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001]\r
14         autolearn=ham\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id I8XP+6lIek8Q for <notmuch@notmuchmail.org>;\r
18         Tue, 16 Nov 2010 14:16:38 -0800 (PST)\r
19 Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com\r
20         [209.85.216.181])\r
21         by olra.theworths.org (Postfix) with ESMTP id 4467C40DDF7\r
22         for <notmuch@notmuchmail.org>; Tue, 16 Nov 2010 14:16:38 -0800 (PST)\r
23 Received: by qyk4 with SMTP id 4so1355983qyk.5\r
24         for <notmuch@notmuchmail.org>; Tue, 16 Nov 2010 14:16:37 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=domainkey-signature:received:mime-version:received:in-reply-to\r
27         :references:from:date:message-id:subject:to:content-type\r
28         :content-transfer-encoding;\r
29         bh=N5XOx7UxMxSDd2/C6+5bOuPr51dvItjhawtKsoQo4Vw=;\r
30         b=kaEGlw1znjeVUwiqjrH+USN9hdfzxPx7uM1jMVVT1AS04FtwULf+A9A1KHVJF87Iok\r
31         +EmfFhGZmOjR3ilXvpxM9HXpvksgo2pD9ZYFluIHuBWnUlEu/mEuMc4BZ2nlHbLPOGi8\r
32         NPNuIB9i6eilWKJwnM1Rw+N0aglxuF9vbRLn4=\r
33 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
34         h=mime-version:in-reply-to:references:from:date:message-id:subject:to\r
35         :content-type:content-transfer-encoding;\r
36         b=ssAnyYVkTQoLsaRD9fqjzSUIB1U3bvaFif92qtqqtCxIvT1U2USDR6UQfF52X2YI9S\r
37         K8IaHB6wsWvC4UnPEkL1gn/NFnxv9dPAXqe3vFaaAAIT5q36lYCYQgDs7uq7fWiQe4cX\r
38         E0DDloqmX7zxiu4tHAXnLZeLk+ZI4sh9q5pXs=\r
39 Received: by 10.229.232.211 with SMTP id jv19mr6794076qcb.28.1289945797700;\r
40         Tue, 16 Nov 2010 14:16:37 -0800 (PST)\r
41 MIME-Version: 1.0\r
42 Received: by 10.229.189.17 with HTTP; Tue, 16 Nov 2010 14:16:07 -0800 (PST)\r
43 In-Reply-To: <4CE2EB89.5040209@fifthhorseman.net>\r
44 References: <AANLkTikKiKC716H+ddF0Q5T0xc=vGHHOVroLRwzO3ujV@mail.gmail.com>\r
45         <87sjz1dr0j.fsf@yoom.home.cworth.org>\r
46         <AANLkTikrXdp5OOCw2Avs8ao9Ukpq8szsdP9FFZP+eYNK@mail.gmail.com>\r
47         <4CE2EB89.5040209@fifthhorseman.net>\r
48 From: "Ciprian Dorin, Craciun" <ciprian.craciun@gmail.com>\r
49 Date: Wed, 17 Nov 2010 00:16:07 +0200\r
50 Message-ID: <AANLkTikMhb=x4jOhOwjP4Ytd+h=4f247ZnA3A0GOS=hC@mail.gmail.com>\r
51 Subject: Re: `notmuch setup` replaces `~/.notmuch-config` instead of\r
52         truncating it\r
53 To: notmuch <notmuch@notmuchmail.org>\r
54 Content-Type: text/plain; charset=UTF-8\r
55 Content-Transfer-Encoding: quoted-printable\r
56 X-BeenThere: notmuch@notmuchmail.org\r
57 X-Mailman-Version: 2.1.13\r
58 Precedence: list\r
59 List-Id: "Use and development of the notmuch mail system."\r
60         <notmuch.notmuchmail.org>\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
64 List-Post: <mailto:notmuch@notmuchmail.org>\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
68 X-List-Received-Date: Tue, 16 Nov 2010 22:16:48 -0000\r
69 \r
70 On Tue, Nov 16, 2010 at 22:37, Daniel Kahn Gillmor\r
71 <dkg@fifthhorseman.net> wrote:\r
72 > On 11/16/2010 03:26 PM, Ciprian Dorin, Craciun wrote:\r
73 >> =C2=A0 =C2=A0 P.S.: I say "pseudo" atomic because only the rename is ato=\r
74 mic,\r
75 >> thus in order to override file `a` for the target file `b` which\r
76 >> exists, we must execute two **non-atomic** operations as a whole, but\r
77 >> each atomic in part, rename operations: make `b` -> `c`, and then\r
78 >> rename `a` -> `b`. So there is actually a small time-frame when I can\r
79 >> be left with two files (`a` and `c`), none of which is my config file\r
80 >> `b`. (This can be solved when opening the config file by checking if\r
81 >> there isn't any leftover `c` or `a` file, in which case I take the `a`\r
82 >> file and complete the rename.)\r
83 >\r
84 > There is only one ".notmuch-config" entry in the inode directory that is\r
85 > your homedir. =C2=A0it points either to the old file, or the new file. =\r
86 =C2=A0it\r
87 > cannot point to both, and it will not point to anything but those two\r
88 > possibilities. =C2=A0This is what the atomicity of the operation is expec=\r
89 ted\r
90 > to guarantee.\r
91 >\r
92 > =C2=A0 =C2=A0 =C2=A0 =C2=A0--dkg\r
93 \r
94 \r
95     Actually I've been wrong about this... I've thought that the way\r
96 the file is "overwritten" is actually done by either two `rename`\r
97 calls or by `link`, followed by another `link`, and then finally an\r
98 `unlink` (this is what I've tried to explain in my previous email).\r
99 \r
100     In fact I've thought that the `rename` OS call can't overwrite a\r
101 file if it exists.\r
102 \r
103     But after reading the man page of `rename(2)` -- quoted below -- I\r
104 was indeed wrong to call the atomicity as being "pseudo".\r
105 \r
106 ~~~~\r
107        int rename(const char *oldpath, const char *newpath);\r
108 ...\r
109        If newpath already exists it will be atomically replaced\r
110 (subject to a few conditions; see ERRORS below),  so  that  there  is\r
111 no\r
112        point at which another process attempting to access newpath\r
113 will find it missing.\r
114 ...\r
115        If newpath exists but the operation fails for some reason\r
116 rename() guarantees to leave an instance of newpath in place.\r
117 ~~~~\r
118 \r
119     So indeed the behavior is completely atomic.\r
120 \r
121     Ciprian.\r