Subject: bug#36079: unhelpful error message

From: Ricardo Wurmus <[email-masked]>
Date: Sun, 09 Jun 2019 22:09:42 +0200

Hi Robert,

> Working on Guix, I encountered the following:
>
> Within a guix checkout, I edited gnu/packages/haskell.scm, accidentally
> making a Haskell comment:
>
>     (arguments
>      `(#:tests? #f)) -- sporadic failure: https://github.com/fpco/streaming-commons/issues/49
>
> Then I tried to keep working on my in-development package, and was able to trace
> the `guix build` error back to the following:
>
> $ ./pre-inst-env guild compile ../modules/postgrest.scm
> ;;; note: source file /home/rob/guix/gnu/packages/haskell.scm
> ;;;       newer than compiled /home/rob/guix/gnu/packages/haskell.go
> ;;; note: source file /home/rob/guix/gnu/packages/haskell.scm
> ;;;       newer than compiled /run/current-system/profile/lib/guile/2.2/site-ccache/gnu/packages/haskell.go
> ice-9/boot-9.scm:752:25: In procedure dispatch-exception:
> Syntax error:
> unknown location: package: invalid field specifier in form —-

This error is produced by the “package” macro, which is of this form:

  (package
   (field value)
   (another-field its-value)
   …)

The macro has a number of valid field names and it tries to do some
simple validation.  That’s where the error comes from.  When “--” is
encountered it is in the position of a field, so the macro tries to be
helpful and reports that “--” is not a valid way to specify a field.

This error message is not produced by Guile.

> There are number of ways the error output could be improved. Ideally, I’d
> like to see the offending line of gnu/packages/haskell.scm pin-pointed,
> and/or the start of the enclosing package definition.

I agree that this would be nice.  Let’s move this to the Guix bug
tracker.

--
Ricardo