2007/7/30, Tommy Pettersson <[EMAIL PROTECTED]>:

> > However, we can do checksum if we want. Maybe a lightweight sha / md5
> > like checksum in file index to prevent this from happening.
>
> That would be the ultimate and near-to-bullet-proof solution (if
> we assume darcs' general lock file guarantee us "atomic"
> operation on the cache).

I've got another, more "lightweight" idea: let's just store file
modification timestamp in file index. If the corresponding timestamp
on the filesystem is different, then we complain (and offer an option
to update the file index, if the user wants). We can take the
timestamp directly from filesystem, and force it with something like
"withFileContentsDo" to bracket file access.

Darcs, as far as I know, already uses timestamps on working copy, to
restrict the number of files to diff.

This is maybe not as bulletproof as the checksum solution, but it
could work, and it is O(1) on file length.

What do you think? Is the hash solution preferable anyway?

This can lead us to another possible solution to the
"detect-pristine-copy-corruption" problem: we just store files as we
always did, but with a file index. Before accessing any file on the
pristine copy, we check the index for its existence, for integrity of
timestamps and so on.

We lose the "case-sensitivity-on-case-insensitive-fs" property, but
again we gain in simplicity and probably performance (I wouldn't bet
on this one).

Anyway, I think we are getting nearer to a good solution to this
problem. A few more "idea-patches" and I'll be ready to start the
implementation :).

Salvatore
_______________________________________________
darcs-devel mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-devel

Reply via email to