[darcs-devel] [issue1461] case-folding can lead to working directory corruption

Ben Franksen bugs at darcs.net
Sat Jul 13 11:49:19 UTC 2019


Ben Franksen <ben.franksen at online.de> added the comment:

>>>  - We probably can't protect against all possible failures. 
>>> Reordering patches could lead to invalid states being created even 
>>> when a particular linearisation of the repository looked fine.
>>
>> I don't believe this is so. [...]
> 
> The kind of example I had in mind was this:
> 
> patch 1: add a
> patch 2: rm a
> patch 3: add A
> 
> now unpull 2.

OMG I feel so stupid. Yes, this could only be avoided if we make it a
global property i.e. you cannot 'add A' if there is an 'add a'
/anywhere/ in the repo (and likewise with move).

>>> - A patch that both removes A and creates a (or renames A to a) 
>>> should be considered valid, though it may require careful 
>>> implementation in apply.
>>
>> I believe we get that behavior by default if we make the check at the
>> level of prim patches and percolate upwards.
> 
> I'd be surprised if both of the following worked without special care:
> 
> atomic patch containing rm A ; add a
> atomic patch containing add a ; rm A

Given your refutation, rather than adding this kind of complexity and
not even gaining full safety, I think the better solution is the global
property. That would mean we forbid a "patch that both removes A and
creates a (or renames A to a)". This is straight forward to implement
and fully safe, unless the user expressly overrides it with a command
line option as I proposed before.

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue1461>
__________________________________


More information about the darcs-devel mailing list