Subject: Re: bug#53165: "guix import opam coq-of-ocaml" unexpected error

From: raingloom <[email-masked]>
Date: Mon, 10 Jan 2022 21:36:57 +0100

On Mon, 10 Jan 2022 18:01:46 +0100
zimoun <[email-masked]> wrote:

> Hi,
> 
> For some reasons, the Opam importer is failing for coq-of-ocaml:
> 
> --8<---------------cut here---------------start------------->8---
> $ guix import opam coq-of-ocaml
> 
> Starting download of /tmp/guix-file.058Nel
> From
> https://github.com/clarus/coq-of-ocaml/releases/download/2.5.1/coq-of-ocaml-full.2.5.1.tar.gz...
> following redirection to
> `https://github.com/foobar-land/coq-of-ocaml/releases/download/2.5.1/coq-of-ocaml-full.2.5.1.tar.gz'...
> following redirection to
> `https://objects.githubusercontent.com/github-production-release-asset-2e65be/14023027/b17b0f80-d4ea-11eb-8861-d8d0c56a130f?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220110%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220110T165945Z&X-Amz-Expires=300&X-Amz-Signature=7422a35182a4ae9cf511471dca445a65316a70e8baa7ffefc9381ce3588002da&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=14023027&response-content-disposition=attachment%3B%20filename%3Dcoq-of-ocaml-full.2.5.1.tar.gz&response-content-type=application%2Foctet-stream'...
> …ll.2.5.1.tar.gz  2.3MiB            44.3MiB/s 00:00
> [##################] 100.0% Backtrace: 8 (primitive-load
> "/home/simon/.config/guix/current/bin/guix") In guix/ui.scm: 2206:7
> 7 (run-guix . _) 2169:10  6 (run-guix-command _ . _) In
> guix/scripts/import.scm: 124:11  5 (guix-import . _)
> In guix/scripts/import/opam.scm:
>    105:23  4 (guix-import-opam . _)
> In guix/build/utils.scm:
>     251:8  3 (call-with-temporary-output-file #<procedure
> 7ff70d73d500 at guix/import/opam.scm:348:12 (temp port)>) In
> guix/import/opam.scm: 374:37  2 (_ _ _)
> In guix/import/utils.scm:
>    244:19  1 (beautify-description #f _)
> In unknown file:
>            0 (string-prefix? "A " #f #<undefined> #<undefined>
> #<undefined> #<undefined>)
> 
> ERROR: In procedure string-prefix?:
> In procedure string-prefix?: Wrong type argument in position 2
> (expecting string): #f --8<---------------cut
> here---------------end--------------->8---
> 
> 
> Cheers,
> simon
> 
> 
> 

My guess is that the package is missing a description? I vaguely recall
running into this or a similar error when trying to import Infer, but
I'm not sure how I fixed it.
Based on the backtrace, just modifying beautify-description? to act as
the identity function when the input isn't a string should be enough.

ps.:
This is why Scheme should have a Maybe type instead of this mess of
overloading boolean false. :)
Or at least Guile should have an optional type checker like MyPy.