Hi Chris,
On Fri, 14 Feb 2025 at 11:54, Christopher Baines <[email protected]> wrote:
>> --8<---------------cut here---------------start------------->8---
>> $ guix build -L foo git2cl-bang
>> Backtrace:
>> In guix/gexp.scm:
>> 1218:2 19 (_ #<store-connection 256.100 7fa4a8355eb0>)
>> 1085:2 18 (_ _)
>> 926:4 17 (_ _)
>> In guix/store.scm:
>> 2095:12 16 (_ #<store-connection 256.100 7fa4a8355eb0>)
>> 1412:11 15 (map/accumulate-builds #<store-connection 256.100 7fa4a8355eb0>
>> #<procedure 7fa4a835cfc0 at guix/store.scm:2096:35 (obj)> _ #:cutoff _)
>> 1330:8 14 (call-with-build-handler #<procedure 7fa4a835cf90 at
>> guix/store.scm:1365:2 (continue store things mode)> _)
>> 2210:25 13 (run-with-store #<store-connection 256.100 7fa4a8355eb0>
>> #<procedure 7fa4aa99c840 at guix/gexp.scm:931:13 (state)> #:guile-for-build
>> _ # _ # _)
>> In guix/gexp.scm:
>> 931:13 12 (_ _)
>> In guix/store.scm:
>> 2038:8 11 (_ _)
>> In guix/gexp.scm:
>> 300:22 10 (_ _)
>> In guix/store.scm:
>> 2142:12 9 (_ #<store-connection 256.100 7fa4a8355eb0>)
>> 1173:24 8 (_ #<store-connection 256.100 7fa4a8355eb0> "git2cl" #t
>> "sha256" "/tmp/git2cl" #:select? _)
>> 1151:14 7 (add-to-store #<store-connection 256.100 7fa4a8355eb0> _ _
>> "sha256" "/tmp/git2cl" #:select? _)
>> In guix/serialization.scm:
>> 380:43 6 (dump "/tmp/git2cl")
>> In srfi/srfi-1.scm:
>> 691:23 5 (filter-map #<procedure 7fa4aa99c2c0 at
>> guix/serialization.scm:322:33 (base)> ("COPYING" "README" "README.html"
>> "git2cl") . _)
>> In guix/serialization.scm:
>> 325:42 4 (_ "COPYING")
>> 325:42 3 (_ "/tmp/git2cl/COPYING")
>> In ice-9/boot-9.scm:
>> 1685:16 2 (raise-exception _ #:continuable? _)
>> 1685:16 1 (raise-exception _ #:continuable? _)
>> 1685:16 0 (raise-exception _ #:continuable? _)
>>
>> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
>> Wrong type to apply: #f
>> --8<---------------cut here---------------end--------------->8---
[...]
> I think this is actually an example where Guix is pretty helpful, you
> didn't have to fight to get a backtrace, and the backtrace is actually
> relevant.
Euh, maybe I do not know enough the internals but I do not find the
backtrace very relevant. It does not even mention ’git-predicate’. :-)
Maybe I’m missing something.
>> The mistake is obviously that ’git-predicate’ always returns #f because
>> /tmp/git2cl is not a Git repository.
>>
>> Hum, I’m not sure to understand well enough how ’local-file’ internally
>> works to propose an improvement (handle the exception).
>
> So, local-file could check what's passed in as select?, and raise an
> exception if it's not a procedure.
>
> That wound't be ideal though, since local-file doesn't know why it's
> getting #f and not a procedure, but it's probably still worth doing.
>
> This is the documented behaviour for git-predicate, and that behaviour
> is used within Guix (it's called like "(or (git-predicate ...". For this
> scenario though, it would help if git-predicate raised an exception,
> rather than returning #f. Then it could clearly say that /tmp/git2cl is
> not a git repository.
Cool, thanks for the explanations. I agree that raising an exception
would be better. I’ll try to scratch my itch if no one beats me. :-)
Cheers,
simon