[darcs-devel] [issue2677] pull --reorder fails to copy patches

Ben Franksen bugs at darcs.net
Sat May 29 14:13:07 UTC 2021


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

On IRC yesterday (and again today, sorry) I was confused, so let me clarify.

What we observe is indeed repository corruption in the sense that after
a pull --reorder, the target repo (our "current" repo) can be in a state
where it doesn't have all patches references by its inventories.

Depending on the way you access this repository, particularly depending
on whether your cache already happens to contain the patch in question,
this will manifest as an error or not, e.g. when cloning the repo, or
when you do a darcs check.

We discovered that 'darcs check' can silently "repair" the repo if the
missing file is in the cache. So a more reliable way to detect the error
make darcs fail is to use `darcs check --no-cache`.

Here is what I found out today:

The issue cannot be reproduced with the head. The "fix" (for the scare
quotes see below) can be tracked down to

patch 018c5978374ec2cb3ae4f918d733da948bda73da
Author: Ben Franksen <ben.franksen at online.de>
Date:   Mon Nov  9 15:47:50 CET 2020
  * improve cache utilization

After adding more debug messages I found out that we *do* call
writeFileUsingCache with the missing patch. The relevant debug output is:

Writing hash file to patches
writeFileUsingCache:0000003658-8f452a132bf0b0e17f177c51ae6aefb0fb29fbb8e42506710d6bd08589336d6d
In fetchFileUsingCachePrivate I'm directly grabbing file contents from
/home/ben/scratch/branch-2.16/_darcs/patches/0000003658-8f452a132bf0b0e17f177c51ae6aefb0fb29fbb8e42506710d6bd08589336d6d

and that's it: writeFileUsingCache does not actually write the file if
it finds it in a 'LocalOnly' source location, more precisely, if the
call to fetchFileUsingCachePrivate LocalOnly ... succeeds. This is the
case because in fetchFileUsingCachePrivate, local function ffuc, the
first case matches because we pull from a local repo (so
isValidLocalPath (hashedFilePathReadOnly c subdir f) == True).

So this is (or rather: was) definitely a bug in writeFileUsingCache.

Now, the way the above patch "fixes" writeFileUsingCache is by adding
more side-effects to fetchFileUsingCachePrivate. As Ganesh remarked on
IRC, this is highly questionable! I agree, which is why I am not
considering the changes I made in the above patch as sufficient.

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


More information about the darcs-devel mailing list