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

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to