Subject: Re: bug#29774: Compilation error on git master: `gzip: unbound variable`

From: Ludovic Courtès <[email-masked]>
Date: Tue, 22 Jan 2019 23:19:19 +0100

Hi Mark,

Mark H Weaver <[email-masked]> skribis:

> I've run into this same problem, on my x86_64 GuixSD system.  To help
> others reproduce it, I've pushed a branch to Savannah, based on recent
> core-updates.  The branch is named 'reproduce-bug-29774'.
>
> When I attempt to build this branch from a clean git checkout, within an
> environment produced by "guix environment guix" from recent
> core-updates, it consistently fails with this error.  If I simply revert
> the commit at the tip of that branch (an early draft of my "Detecting
> duplicate field initializers" patch), then the problem does not occur.
>
> I find it quite surprising that this apparently unrelated patch makes
> any difference to this bug, but that seems to be the case.

[...]

>   LOAD     guix/scripts/package.scm
>   LOAD     guix/scripts/gc.scm
>   LOAD     guix/scripts/hash.scm
>   LOAD     guix/scripts/pack.scm
> Backtrace:
> In ice-9/boot-9.scm:
>     142:2 19 (dynamic-wind _ _ #<procedure 2701760 at ice-9/eval.scm:330:13 ()>)
>     142:2 18 (dynamic-wind _ _ #<procedure 27013e0 at ice-9/eval.scm:330:13 ()>)
> In ice-9/eval.scm:
>     619:8 17 (_ #(#(#<directory (guix build compile) 21988c0> #<variable 252b550 value: 674> #<procedure 26fe3c0 at ice-9/eval.scm:339:13 (a b c)> 1 # …)))
>     619:8 16 (_ #(#(#(#(#(#(#(#<directory (guix build compile) 21988c0> ("guix/scripts/pack.scm" "guix/scripts/pull.scm" "guix/scri…" …) …)) …) …) …) …) …))
> In ice-9/boot-9.scm:
>     152:2 15 (with-fluid* _ _ _)
>   2788:17 14 (resolve-interface (guix scripts pack) #:select _ #:hide _ #:prefix _ #:renamer _ #:version _)
>   2714:10 13 (_ (guix scripts pack) _ _ #:ensure _)
>   2982:16 12 (try-module-autoload _ _)
>    2312:4 11 (save-module-excursion #<procedure 60f7000 at ice-9/boot-9.scm:2983:17 ()>)
>   3002:22 10 (_)
> In unknown file:
>            9 (primitive-load-path "guix/scripts/pack" #<procedure 69e5f60 at ice-9/boot-9.scm:2989:32 ()>)
> In ice-9/eval.scm:
>    626:19  8 (_ #<directory (guix scripts pack) 7891960>)
>    173:39  7 (_ #<directory (guix scripts pack) 7891960>)
>    202:51  6 (_ #<directory (guix scripts pack) 7891960>)
>    202:35  5 (_ #<directory (guix scripts pack) 7891960>)
>     155:9  4 (_ #<directory (guix scripts pack) 7891960>)
>    202:35  3 (_ #<directory (guix scripts pack) 7891960>)
>     159:9  2 (_ #<directory (guix scripts pack) 7891960>)
>    223:20  1 (proc #<directory (guix scripts pack) 7891960>)
> In unknown file:
>            0 (%resolve-variable (7 . gzip) #<directory (guix scripts pack) 7891960>)
>
> ERROR: In procedure %resolve-variable:
> gzip: unbound variable

I was able to reproduce it on this ‘reproduce-bug-29774’ branch, and
also by just cherry-picking the detect-duplicate-field-initializer patch
on top of ‘master’.

As it turns out, build-aux/compile-all.scm was simply hiding the actual
error message, which was a duplicate field initializer in (gnu packages
haskell), and eventually threw that backtrace because (guix scripts
pack) is the module that indirectly triggered the loading of (gnu
packages haskell).  (Setting ‘%load-verbosely’ is what helped me find
out…)

Commit 1709b2e414195ae41a66d4fec37a25b1602629f7 lets those error
messages through, and commit 22a894bedd62181cdd382da3f0d49aea7fcd3a1a
implements duplicate field initializer detection in a way slightly
different from your original patch.

Thanks,
Ludo’.