[bug#65352] Fix time-machine and network
Commit Message
Hi Ludo,
On Mon, 04 Sep 2023 at 10:49, Ludovic Courtès <ludo@gnu.org> wrote:
> Houston, we have a problem:
This is Houston. Say again, please. :-)
> diff --git a/guix/git.scm b/guix/git.scm
> index ebe2600209..5fa604f9a0 100644
> --- a/guix/git.scm
> +++ b/guix/git.scm
> + (()
> + (resolve-reference repository
> + '(symref . "refs/remotes/origin/HEAD"))))))
The fix is to simple return #false when the reference is not resolved.
Well, let me now if the attached patch fixes the issue.
Cheers,
simon
Comments
Hi Simon,
Simon Tournier <zimon.toutoune@gmail.com> writes:
[...]
>>From e1fdd6748ebb1088fb805d77cfb176758bab5618 Mon Sep 17 00:00:00 2001
> Message-Id: <e1fdd6748ebb1088fb805d77cfb176758bab5618.1693826861.git.zimon.toutoune@gmail.com>
> From: Simon Tournier <zimon.toutoune@gmail.com>
> Date: Mon, 4 Sep 2023 13:23:59 +0200
> Subject: [PATCH] guix: git: Add default case when resolving reference.
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> Reported by Ludovic Courtès <ludo@gnu.org>.
>
> * guix/git.scm (resolve-reference): Return #false when the reference is not
> resolved.
> ---
> guix/git.scm | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/guix/git.scm b/guix/git.scm
> index ebe2600209d4..d4076d4a0a0c 100644
> --- a/guix/git.scm
> +++ b/guix/git.scm
> @@ -282,7 +282,8 @@ (define (resolve-reference repository ref)
> (if (= OBJ-TAG (object-type obj))
> (object-lookup repository
> (tag-target-id (tag-lookup repository oid)))
> - obj))))))
> + obj)))
> + (_ #f))))
This doesn't look right to me; the contract of resolve-reference is to
accept a REF, which is well defined. It's not supposed fall into cracks
and return #f. The problem lies elsewhere.
Hi Maxim,
On Tue, 05 Sep 2023 at 16:33, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
>> - obj))))))
>> + obj)))
>> + (_ #f))))
>
> This doesn't look right to me; the contract of resolve-reference is to
> accept a REF, which is well defined. It's not supposed fall into cracks
> and return #f. The problem lies elsewhere.
Yes, the problem lies elsewhere! By the code you introduced with
79ec651a286c71a3d4c72be33a1f80e76a560031. As explained here:
[bug#65352] Fix time-machine and network
Simon Tournier <zimon.toutoune@gmail.com>
Mon, 04 Sep 2023 19:37:08 +0200
id:87wmx5on5n.fsf@gmail.com
https://issues.guix.gnu.org//65352
https://issues.guix.gnu.org/msgid/87wmx5on5n.fsf@gmail.com
https://yhetil.org/guix/87wmx5on5n.fsf@gmail.com
Because of this code, you are breaking the contract and passing '() as
REF. Hence my patch.
Cheers,
simon
From e1fdd6748ebb1088fb805d77cfb176758bab5618 Mon Sep 17 00:00:00 2001
Message-Id: <e1fdd6748ebb1088fb805d77cfb176758bab5618.1693826861.git.zimon.toutoune@gmail.com>
From: Simon Tournier <zimon.toutoune@gmail.com>
Date: Mon, 4 Sep 2023 13:23:59 +0200
Subject: [PATCH] guix: git: Add default case when resolving reference.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Reported by Ludovic Courtès <ludo@gnu.org>.
* guix/git.scm (resolve-reference): Return #false when the reference is not
resolved.
---
guix/git.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
@@ -282,7 +282,8 @@ (define (resolve-reference repository ref)
(if (= OBJ-TAG (object-type obj))
(object-lookup repository
(tag-target-id (tag-lookup repository oid)))
- obj))))))
+ obj)))
+ (_ #f))))
(define (switch-to-ref repository ref)
"Switch to REPOSITORY's branch, commit or tag specified by REF. Return the
base-commit: bedcdf0fb5ac035f696790827679406c7146396c
--
2.38.1