From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1B2BC40DAE5 for ; Tue, 16 Nov 2010 12:37:47 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.899 X-Spam-Level: X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, UNPARSEABLE_RELAY=0.001] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5-CV3VshMTNC for ; Tue, 16 Nov 2010 12:37:37 -0800 (PST) Received: from rodolpho.mayfirst.org (rodolpho.mayfirst.org [209.234.253.107]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id F35D240DBFA for ; Tue, 16 Nov 2010 12:37:36 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by rodolpho.mayfirst.org (Postfix) with ESMTP id 7A70F3CD51; Tue, 16 Nov 2010 15:37:34 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at rodolpho.mayfirst.org Received: from rodolpho.mayfirst.org ([127.0.0.1]) by localhost (rodolpho.mayfirst.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0F8NQMEZrwfK; Tue, 16 Nov 2010 15:37:34 -0500 (EST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: smtpauth@rodolpho.mayfirst.org) with ESMTPSA id 204E83CD4C Message-ID: <4CE2EB89.5040209@fifthhorseman.net> Date: Tue, 16 Nov 2010 15:37:29 -0500 From: Daniel Kahn Gillmor User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.9) Gecko/20100918 Icedove/3.1.4 MIME-Version: 1.0 To: "Ciprian Dorin, Craciun" , notmuch@notmuchmail.org Subject: Re: `notmuch setup` replaces `~/.notmuch-config` instead of truncating it References: <87sjz1dr0j.fsf@yoom.home.cworth.org> In-Reply-To: X-Enigmail-Version: 1.1.2 OpenPGP: id=D21739E9 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig56E47B72ECF88BC472B23755" X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: notmuch List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Nov 2010 20:37:47 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig56E47B72ECF88BC472B23755 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 11/16/2010 03:26 PM, Ciprian Dorin, Craciun wrote: > So in the light of the above quoted "glitches", my question is: > due to the small chance of a power loss happening right when we write > such a small file, doesn't the inconvenience weight more than the > (fairly remote probable) file loss? What inconvenience? The inconvenience of writing the code correctly? that's a small one-time cost compared to *any* risk of a user ending up with a damaged .notmuch-config (not to mention possible concurrent uses of notmuch seeing an intermediate version of the file) > P.S.: I say "pseudo" atomic because only the rename is atomic, > thus in order to override file `a` for the target file `b` which > exists, we must execute two **non-atomic** operations as a whole, but > each atomic in part, rename operations: make `b` -> `c`, and then > rename `a` -> `b`. So there is actually a small time-frame when I can > be left with two files (`a` and `c`), none of which is my config file > `b`. (This can be solved when opening the config file by checking if > there isn't any leftover `c` or `a` file, in which case I take the `a` > file and complete the rename.) There is only one ".notmuch-config" entry in the inode directory that is your homedir. it points either to the old file, or the new file. it cannot point to both, and it will not point to anything but those two possibilities. This is what the atomicity of the operation is expected to guarantee. --dkg --------------enig56E47B72ECF88BC472B23755 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBCgAGBQJM4uuJAAoJEMzS7ZTSFznp6X8QAIiz2toG3b2OZjq5a8wWF+Ed wazszczwPnxr9YPiXBTxEPqmAFoInFhoNOt0ebNbo6aiE6G+COeVxRzFjudWx23Q K1KLPMuGglw1acvmYAr1qsOxM689VVh14txXGRAe5U4dlJ7Pv500tTk0zYmjIvoe ojAVW+xUgpMTU4H3OaQqGPxZysuG8IGhXdibc3mwvSGrQ/DsxDhSUYiyW8BaEXnH sIp+ShvV5d8j7Ta6p8N2Q8BXSVQdVNomETZLW+wFvZqPGTsGBT7krB2o3G+ifnLb Rpd9SUrIs598hZYOMKQJsTc+aCak0sWkBQrD1Kd6XL0ZwR/8MdcEAlTXFxcgiWsm y5zENJtVEB2rMvubZe5S56nBzII7Mfgk81CJw3DnObtEa6dlb89ZflMdoTQI6Zih Jx6zPf6oZ1Ogi332+h8or5sVOvuh7N8Wc3rBQ7jNfNqeTl5OYoPSAjte5fpLrElE 62nfTdsUOQ2I9FPXkQm0F86U0rm+mzVVSVBwDD0+jx6d1r4e1QzGoJlUdvSQE6CA XN5qTyG2g0Kln1TP3qmwDaPcoK8AkmW+8BSWSUc6jZCITlDT2bYvfIfhVKcKQPtH hnSf20vvkczs/nrkC5gUgmEP47EX+Dwl/KqZMq3/IrYe3ngXdvlCN05O29tptM9f t083v+6uxr8dzwtwkVI/ =1AhV -----END PGP SIGNATURE----- --------------enig56E47B72ECF88BC472B23755--