[darcs-devel] Re: [darcs #201] "Fail: takeLock (Permission denied)"
Causes Inconsistent State
Mark Stosberg
mark at summersault.com
Fri Feb 4 18:01:04 PST 2005
On 2005-02-04, David Roundy <droundy at abridgegame.org> wrote:
> On Thu, Feb 03, 2005 at 11:50:48AM -0500, via RT wrote:
>> While pulling, I got the following error:
>>
>> Fail: takeLock foo.txt-0: permission denied (Permission denied)
>>
>> because (upon later investigation) I didn't have sufficient permission to
>> write to a directory into which darcs wanted to pull some newly-added
>> files. Unfortunately, though, darcs did add the files into the
>> _darcs/current/ tree, thus causing an inconsistency between the darcs
>> current directory and my working directory. Subsequent use of darcs
>> check did not notice the inconsistency.
>
> I'm not quite clear which directory the problem was in, which would be
> helpful. This error message will be clearer in darcs 1.0.2 (which will be
> released either today or tomorrow).
>
> Am I right that this was a subdirectory in your working directory to which
> there were no write permissions?
[ I'll try to answer for the requestor, who is a co-worker. ]
Yes, you're right about this.
> If that is the case, I'm not sure what
> darcs should have done. Darcs *could* (in principle) check whether it has
> write permissions prior to making any modifications. We'd only need to
> check permissions on directorys... except under windows, where we'd also
> need to check permissions on all files. And there still would be no
> guarantee, since the permissions could change after we checked them.
I think it would be nice to check for write permissions, even if they
may change (that seems unlikely).
> Or alternatively, in case of errors we could try to backtrack and undo the
> changes we've already done. That seems even more dangerous, since it's
> quite possible (e.g. disk-full error) that the same thing that caused the
> first failure will also interfere with the backtracking.
>
> So in short, I'm not sure (apart from fixing the error message) what could
> or should be done in this situation.
Part of the improvement could be for the error message to suggest a
solution to recover from the inconsistent state. Something like:
darcs was not able to write to: /path/to/dir
This may have left your working directory an inconsistent but
recoverable state. Assuming you had no un-recorded changes
in the affected files, using 'darcs revert' you should
make your working directory consistent again.
Mark
--
http://mark.stosberg.com/
More information about the darcs-devel
mailing list