[prev in list] [next in list] [prev in thread] [next in thread] 

List:       darcs-devel
Subject:    Re: [darcs-devel] [issue2644] detect "invalid" patches on pull and apply
From:       Ben Franksen <ben.franksen () online ! de>
Date:       2020-05-14 15:52:38
Message-ID: r9jpg7$fjb$1 () ciao ! gmane ! io
[Download RAW message or body]

Am 14.05.20 um 00:34 schrieb Ganesh Sittampalam:
> On 10/05/2020 10:58, Ben Franksen wrote:
>> Am 08.05.20 um 23:54 schrieb Ganesh Sittampalam:
>>> Inventories only contain hashes of patch metadata
>>
>> No, they contain the patch content hashes. This is necessarily so, as
>> these are the file names we look up in _darcs/patches (and other cached
>> sources).
> 
> Sorry, yes, I was confusing them with tags. So this algorithm would be
> different from the standard "findCommon" approach, right?

Yes. The standard findCommon approach is to completely rely on patch
identities. The new algorithm would always check that the contents also
match, bringing the patches into a common context if necessary
(preferring to commute locally, for efficiency); otherwise the two
appraches are similar.

I have made some preliminary experiments but these are incomplete as of
now. My starting point was D.P.Depends.taggedIntersection and the idea
to gradually modify that, throwing exceptions when we encounter a
content/hash mismatch. One problem is that hashes may not be there (they
are behind a Maybe in PatchSet and in PatchInfoAnd) so the first thing
to do was to add functions that give us a hash unconditionally: if we
don't have one, we serialize and calculate the hash on the fly. I think
this code shouldn't normally be executed in practice, since inventories
and patches that are freshly read always come with hashes, and we loose
the hashes only when we manipulate the content (invert, commute, merge
for patches, open inventories etc).

Note that we cannot rely on =\/= and friends for content checks as these
may use indentities internally. It bites us here that we never merged my
equality refactors, as that would have added patch comparison that does
not rely on identity.

Cheers
Ben

_______________________________________________
darcs-devel mailing list
darcs-devel@osuosl.org
https://lists.osuosl.org/mailman/listinfo/darcs-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic