[darcs-users] 'darcs add' loses inital file contents, a timestamp problem?

David Roundy droundy at abridgegame.org
Fri Apr 18 12:33:47 UTC 2003


On Thu, Apr 17, 2003 at 05:44:06PM +0100, Philip Martin wrote:
> The problem goes away if I uncomment the 'sleep 1' command between the
> add and record commands.  I suspect that darcs is relying on file
> timestamps somewhere, and not getting it quite right.

Yes, when darcs sees that its internal copy of a file is identical to the
working version, it sets the modification time of its copy equal to that of
the file.  This way we don't have to read in every file each time we run a
record or whatsnew, which is good.  Eventually, I should add a flag to have
darcs ignore modification times...

> Now obviously I can always explicitly set timestamps and cause a
> timestamp based system to misbehave, but I would classify that as
> deliberate "abuse".  I don't consider either of the above cases to
> fall into that category.

For the moment, I've fixed the races above by adding a little wait so that
the modification times are different.  Unfortunately, this reveals another
problem, which is that the haskell Posix library only gives me the file
modification times in seconds, and only lets me set them in seconds, which
means I have to wait a second or two to avoid the race.  That is very bad.
So some time I'll also have to get around to writing an interface to the
posix timing code that doesn't throw away the more accurate times that are
actually kept by the system.  This will not only make the waiting much less
of a problem, but will also greatly decrease the chance of any remaining
race actually occuring.  For example, if you modify a file while running
darcs whatsnew, you could still trigger the bug.  For the moment, my
solution is that doing any modifications on your working directory while
darcs is running on it is unsupported behavior.

Note, however, that these bugs do not lead to an inconsistent repo, since
they only involve darcs being ignorant of the contents of the working
directory.

btw, I like getting these problems as runnable scripts.
-- 
David Roundy
http://www.abridgegame.org




More information about the darcs-users mailing list