Subject: Re: [bug#65352] Fix time-machine and network

From: Maxim Cournoyer <[email-masked]>
Date: Tue, 05 Sep 2023 22:39:09 -0400

Hi,

Simon Tournier <[email-masked]> writes:

> Hi Maxim,
>
> On Tue, 05 Sep 2023 at 16:39, Maxim Cournoyer <[email-masked]> wrote:
>
>> I've reviewed this thread and the code, and I agree.  This is a special
>> case.  I've added a comment so we aren't tempted to use
>> 'resolve-reference' there again.
>
> I disagree.  There is no special case.  The culprit is the procedure
> ’validate-guix-channel’ as explained in:

I was referring to the special case of resolved-reference? (that it
mustn't trust tags or branches in a git cache -- at least currently,
compared to resolve-reference.  Maybe we want to change that?

>         [bug#65352] Fix time-machine and network
>         Simon Tournier <[email-masked]>
>         Mon, 04 Sep 2023 19:37:08 +0200
>         id:[email-masked]
>         https://issues.guix.gnu.org//65352
>         https://issues.guix.gnu.org/msgid/[email-masked]
>         https://yhetil.org/guix/[email-masked]
>
>
>> Will install shortly.
>
> I do not know what you will install shortly.  The fix belong to
> validate-guix-channel, something like:
>
>          (let* ((guix-channel (find guix-channel? channels))
>                 (reference (or ref
>                                (match (channel-commit guix-channel)
>                                  (#f `(branch . ,(channel-branch guix-channel)))
>                                  (commit `(tag-or-commit . ,commit)))))
>                 (checkout commit relation (update-cached-checkout
>                                            (channel-url guix-channel)
>                                            #:ref reference
>                                            #:starting-commit
>                                            %oldest-possible-commit)))
>
> and that would avoid to break the “contract” of resolve-reference.
> Before committing something, I was testing.

That's orthogonal to the other issue discussed, right?  What I was
referring to about 'installing' was c3d48d02, which implements the above
(with let-bound variables and 'if' instead of match, but the logic is
the same).

I feel like we need to agree on what reference-available? is supposed to
achieve, and where it needs to differentiate from resolve-reference.

-- 
Thanks,
Maxim