Subject: bug#47949: Failed to produce output path for guix-package-cache

From: Vagrant Cascadian <[email-masked]>
Date: Wed, 02 Nov 2022 11:40:20 -0700

On 2022-11-02, zimoun wrote:
> On ven., 28 oct. 2022 at 13:23, Vagrant Cascadian <[email-masked]> wrote:
>
>>> Oh yeah, that reminds me to add to the confusion, "guix time-machine
>>> --commit=SOMECOMMIT" worked fine, even where "SOMECOMMIT" didn't
>>> successfully work with guix pull.
>>>
>>> Maybe that's a clue pointing to the crufty .cache directories?
>>
>> Well, after removing ~/.cache/guix/checkouts/ I haven't had the problem
>> again, with several successful pulls.
>
> Well, “guix time-machine --commit=<some-commit>” uses,
>
> --8<---------------cut here---------------start------------->8---
> (define %default-channel-url
>   ;; URL of the default 'guix' channel.
>   "https://git.savannah.gnu.org/git/guix.git")
>
> (define %default-guix-channel
>   (channel
>    (name 'guix)
>    (branch "master")
>    (url %default-channel-url)
>    (introduction %guix-channel-introduction)))
>
> (define %default-channels
>   ;; Default list of channels.
>   (list %default-guix-channel))
> --8<---------------cut here---------------end--------------->8---
>
> which is another directory checkout under ~/.cache/guix/checkouts. :-)

Ok, that's promising. :)

>> This suggests to me that guix should make sure to not use a dirty
>> checkout to prevent this in the future ... either exporting the guix
>> tree it's working with to a temporary location, or something like
>> running "git clean -dfx" before using the checkout...
>
> From my understanding, you have 3 similar checkouts of Guix; the default one:
>
> --8<---------------cut here---------------start------------->8---
> $ cat  ~/.cache/guix/checkouts/pjmkglp4t7znuugeurpurzikxq3tnlaywmisyr27shj7apsnalwq/.git/config
> [core]
> 	bare = false
> 	repositoryformatversion = 0
> 	filemode = true
> 	logallrefupdates = true
> [remote "origin"]
> 	url = https://git.savannah.gnu.org/git/guix.git
> 	fetch = +refs/heads/*:refs/remotes/origin/*
> [branch "master"]
> 	remote = origin
> 	merge = refs/heads/master
> --8<---------------cut here---------------end--------------->8---
>
> and then 2 others, probably located at these hash names:
>
> --8<---------------cut here---------------start------------->8---
> $ guix repl
> GNU Guile 3.0.8
> Copyright (C) 1995-2021 Free Software Foundation, Inc.
>
> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> This program is free software, and you are welcome to redistribute it
> under certain conditions; type `,show c' for details.
>
> Enter `,help' for help.
> scheme@(guix-user)> ,use(guix git)
> scheme@(guix-user)> ,pp (map url-cache-directory (list
> "https://git.savannah.gnu.org/git/guix.git"
> "file:///home/vagrant/src/guix"
> "file:///home/vagrant/src/guix-master"))
> $1 = (
>  "/home/simon/.cache/guix/checkouts/pjmkglp4t7znuugeurpurzikxq3tnlaywmisyr27shj7apsnalwq"
>  "/home/simon/.cache/guix/checkouts/cbek2jy4zeoea2wj4xppwabceeayfzzuap6iw6uk7kylh4hdolfa"
>  "/home/simon/.cache/guix/checkouts/duxgcjge5pc2tzexf4qwjra3uzu3t4htsxojtxralegek3bqkisa"
> )
> --8<---------------cut here---------------end--------------->8---

Hashes are coming out different, maybe without the file:// prefix?

> then you pulled,
>
>   guix pull --url=/home/vagrant/src/guix --branch=master
>
> and sometimes:
>
>   guix pull --url=/home/vagrant/src/guix-master --branch=master
>
> How clean are these 2 local repositories?

src/guix tends to have cruft laying around, but src/guix-master I tend
to keep clean, barring accidents. I *usually* just pull from
src/guix-master, which is essentially a local mirror of upstream
guix.git. Though I suspect the state of the local branch does not or at
least should not matter, since it's pulling from --branch=master.

> I do not know if “git clean -dfx” would help because here the error is
> probably between the repositories src/guix and src/guix-master and Guix
> manages them under 2 unrelated directory checkouts.

I had the impression that it uses git to copy the branches (rather than
cp -r or something), otherwise the --branch=master argument would be
meaningless (e.g. --branch=master does not mean whatever happens to be
in the working directory), so I would assume the state of the local
working directory wouldn't matter, only what's in the specified branch
as git sees it.

So My suspicion here is somehow guix is working off of dirty checkouts
in ~/.cache/guix/checkouts ... which, maybe would not be so hard to
reproduce ... just drop some files from an ancient checkout or
something. Not sure what the conditions are necessary to make it
actually leave behind cruft in a way that triggers the issue. It
definitely seemed related to an old copy of wicd.scm that has since been
removed.

FWIW, I use my git checkout to avoid re-downloading the git history
multiple times... since I already typically have a full copy of the git
history.

> When you cleaned ~/.cache/guix/checkouts and pulled again, you created a
> new directory checkout.  Based on which origin?  Default?  Or src/guix?
> Or src/guix-master?

I think so far only src/guix-master.

live well,
  vagrant