guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#74481] [PATCH 1/2] git: Catch Git errors when updating cached check


From: Ludovic Courtès
Subject: [bug#74481] [PATCH 1/2] git: Catch Git errors when updating cached checkout.
Date: Tue, 17 Dec 2024 11:55:25 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

HI,

Simon Tournier <zimon.toutoune@gmail.com> skribis:

> On Thu, 12 Dec 2024 at 12:35, Ludovic Courtès <ludo@gnu.org> wrote:
>
>> Sorry for not replynig earlier.  I would avoid such a change: it changes
>> the semantics of ‘resolve-reference’ in a non-trivial and hard-to-test
>> way.
>
> Could you explain more what you mean for "the semantics" of
> 'resolve-reference'?

We have something that can now return #f instead of throwing an
exception.  The many users of this interface are not prepared for this;
worse, getting #f instead of an exception means we lose information as
to why ‘update-cached-checkout’ or similar failed.

>> Instead, since the goal is to address a problem that’s specific to
>> importers (or to one importer), I would suggest making a local change in
>> the importer itself, or in code that is shared among importers only.

[...]

> If you think that's possible to have a local change somewhere in the
> importers, please point me because I'm clueless. :-)

I haven’t looked in detail, so I’m starting from the use case at the
beginning of this thread:

--8<---------------cut here---------------start------------->8---
$ guix import go software.sslmate.com/src/go-pkcs12
guix import: Importing package "software.sslmate.com/src/go-pkcs12"...
guix import: warning: Unable to determine repository root of 
'software.sslmate.com/src/go-pkcs12'. Guessing 
'software.sslmate.com/src/go-pkcs12'.
SWH: found revision fa70679f0f1622a2705336a97225ee8d6c555f96 with directory at 
'https://archive.softwareheritage.org/api/1/directory/43d3e9f7167cdcd9f179e8d1de33d0d22e8fbd46/'
swh:1:rev:fa70679f0f1622a2705336a97225ee8d6c555f96.git/
swh:1:rev:fa70679f0f1622a2705336a97225ee8d6c555f96.git/HEAD
swh:1:rev:fa70679f0f1622a2705336a97225ee8d6c555f96.git/branches/

[...]

In guix/scripts/import/go.scm:
   116:29  4 (_)
In ice-9/eval.scm:
    619:8  3 (_ #(#(#<directory (guix import go) 7fa85b580d20> # ?) ?))
   174:20  2 (_ #(#(#<directory (guix import go) 7fa85b580d20> # ?) ?))
   177:32  1 (lp (#<procedure 7fa8598a1380 at ice-9/eval.scm:191:12?>))
In ice-9/boot-9.scm:
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure git-error-message: Wrong type argument: #<&compound-exception 
components: (#<&error> #<&irritants irritants: (#<<git-error> code: -3 message: 
"reference 'refs/tags/v0.5.0' not found" class: 4>)> 
#<&exception-with-kind-and-args kind: git-error args: (#<<git-error> code: -3 
message: "reference 'refs/tags/v0.5.0' not found" class: 4>)>)>
--8<---------------cut here---------------end--------------->8---

Would it be an option to catch 'git-error around the
‘update-cached-checkout’ call in (guix import go)?  If an exception is
thrown, it would print a warning and return a fake hash.

Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]