Subject: Re: bug#55639: time-machine back in 2020: weird error

From: zimoun <[email-masked]>
Date: Tue, 31 May 2022 20:27:43 +0200

Hi,

On mar., 31 mai 2022 at 16:32, Ludovic Courtès <[email-masked]> wrote:

> This looks like something different, but it’s very weird.  The unhelpful
> ‘match-error’ seems to occur early on:
>
> $ head -1942 ~/.cache/guix/inferiors/wulvgnewx2av6dvgkq6adku4kzmlva75l2gukndywh7wvzenkmoa/share/guile/site/3.0/guix/ui.scm | tail -12
>       ;; Disable canonicalization so we don't don't stat unreasonably.
>       (with-fluids ((%file-port-name-canonicalization #f))
>         (dynamic-wind
>           (const #f)
>           (lambda ()
>             (apply command-main args))
>           (lambda ()
>             ;; Abuse 'exit-hook' (which is normally meant to be used by the
>             ;; REPL) to run things like profiling hooks upon completion.
>             (run-hook exit-hook)))))))
>
> (define (run-guix . args)

Is it possible that it comes from Guile 3.0.2 on a recent CPU?

> Does “guix time-machine --commit=a7b20226b2 -- help” work for you?

Yes.

--8<---------------cut here---------------start------------->8---
$ guix time-machine --commit=a7b20226b2 -- build hello
guile: warning: failed to install locale
Backtrace:
           1 (primitive-load "/home/simon/.cache/guix/inferiors/wulvgnewx2av6dvgkq6adku4kzmlva75l2gukndywh7wvzenkmoa/bin/guix")
In guix/ui.scm:
  1936:12  0 (run-guix-command _ . _)

guix/ui.scm:1936:12: In procedure run-guix-command:
Throw to key `match-error' with args `("match" "no matching pattern" #<derivation /gnu/store/c6hgmfq0i4zgryqyl0ab1ms51fnrkmdv-bootstrap-binaries-0.drv => /gnu/store/5bdaayvl6cs8nrdivskz4dbrsy2m009c-bootstrap-binaries-0 7efc8591fe60>)'.

$ guix time-machine --commit=a7b20226b2 -- build /gnu/store/c6hgmfq0i4zgryqyl0ab1ms51fnrkmdv-bootstrap-binaries-0.drv
guile: warning: failed to install locale
/gnu/store/5bdaayvl6cs8nrdivskz4dbrsy2m009c-bootstrap-binaries-0
--8<---------------cut here---------------end--------------->8---

> Can you fiddle at the REPL and try to see more precisely what’s failing?
>
>   guix time-machine --commit=a7b20226b2 -- repl -q

--8<---------------cut here---------------start------------->8---
$ guix time-machine --commit=a7b20226b2 -- repl -q
guile: warning: failed to install locale
GNU Guile 3.0.2
Copyright (C) 1995-2020 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guix-user)> (use-modules (guix store) (guix packages) (gnu packages guile))
scheme@(guix-user)> (with-store store (package-derivation store guile-3.0))
ice-9/boot-9.scm:1669:16: In procedure raise-exception:
Throw to key `match-error' with args `("match" "no matching pattern" #<derivation /gnu/store/c6hgmfq0i4zgryqyl0ab1ms51fnrkmdv-bootstrap-binaries-0.drv => /gnu/store/5bdaayvl6cs8nrdivskz4dbrsy2m009c-bootstrap-binaries-0 7f1910e6a6e0>)'.

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guix-user) [1]> ,bt
In ice-9/boot-9.scm:
  1736:10 33 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In guix/store.scm:
   630:22 32 (thunk)
In guix/packages.scm:
   966:16 31 (package-derivation _ #<package [email-masked] gnu/packages/guile.scm:284 7f1910b7e500> _ #:graft? _)
  1285:22 30 (thunk)
  1218:25 29 (bag->derivation #<store-connection 256.99 7f1910e0eeb0> #<<bag> name: "guile-3.0.2" system: "x86_64-linux" target: #f build-inp…> …)
In srfi/srfi-1.scm:
   586:17 28 (map1 (("source" #<origin "mirror://gnu/guile/guile-3.0.2.tar.xz" kpch2mqfgpeaumkfvw6yhyklxyihybcbygfiwikp6ieetmukt6fa ("/gn…>) …))
In guix/packages.scm:
   1028:5 27 (expand-input _ _ _ _ _)
In ice-9/boot-9.scm:
  1736:10 26 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In guix/packages.scm:
  1033:18 25 (_)
In guix/store.scm:
  2017:24 24 (run-with-store #<store-connection 256.99 7f1910e0eeb0> #<procedure 7f1910e4a880 at guix/gexp.scm:234:5 (state)> #:guile-for-build …)
   1851:8 23 (_ _)
In guix/packages.scm:
   1390:5 22 (_ _)
In guix/store.scm:
  1886:38 21 (_ #<store-connection 256.99 7f1910e6af50>)
In guix/packages.scm:
   966:16 20 (package-derivation _ #<package [email-masked] guix/build-system/gnu.scm:143 7f1910e480a0> _ #:graft? _)
  1285:22 19 (thunk)
  1218:25 18 (bag->derivation #<store-connection 256.99 7f1910e6af50> #<<bag> name: "guile-3.0.2" system: "x86_64-linux" target: #f build-inp…> …)
In srfi/srfi-1.scm:
   586:17 17 (map1 (("source" #<origin "mirror://gnu/guile/guile-3.0.2.tar.xz" kpch2mqfgpeaumkfvw6yhyklxyihybcbygfiwikp6ieetmukt6fa ("/gn…>) …))
In guix/packages.scm:
   1028:5 16 (expand-input _ _ _ _ _)
In ice-9/boot-9.scm:
  1736:10 15 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In guix/packages.scm:
  1033:18 14 (_)
In guix/store.scm:
  2017:24 13 (run-with-store #<store-connection 256.99 7f1910e6af50> #<procedure 7f1910e684c0 at guix/gexp.scm:234:5 (state)> #:guile-for-build …)
   1851:8 12 (_ _)
In guix/gexp.scm:
    961:2 11 (_ _)
    821:2 10 (_ _)
In guix/store.scm:
  1899:12  9 (_ #<store-connection 256.99 7f1910e6af50>)
   1336:2  8 (map/accumulate-builds #<store-connection 256.99 7f1910e6af50> _ _)
In srfi/srfi-1.scm:
   586:17  7 (map1 ((#<package bootstrap-binaries@0 gnu/packages/bootstrap.scm:212 7f191a8f5500> "out") ("/gnu/store/a7s2cq1by31wzqqas967x…") …))
In guix/store.scm:
   1295:8  6 (call-with-build-handler #<procedure build-accumulator (continue store things mode)> _)
  2017:24  5 (run-with-store #<store-connection 256.99 7f1910e6af50> #<procedure 7f1910ebfb00 at guix/gexp.scm:691:8 (state)> #:guile-for-build …)
In guix/gexp.scm:
   693:18  4 (_ _)
In ice-9/boot-9.scm:
  1669:16  3 (raise-exception _ #:continuable? _)
  1667:16  2 (raise-exception _ #:continuable? _)
  1667:16  1 (raise-exception _ #:continuable? _)
  1669:16  0 (raise-exception _ #:continuable? _)
scheme@(guix-user) [1]> ,fr 7
In srfi/srfi-1.scm:
   586:17  7 (map1 ((#<package bootstrap-binaries@0 gnu/packages/bootstrap.scm:212 7f191a8f5500> "out") ("/gnu/store/a7s2cq1by31wzqqas967x…") …))
scheme@(guix-user) [1]> ,locals
  Local variables:
  $1 = closure = #<procedure 7f1910e83270 at guix/store.scm:1337:9 (obj)>
  $2 = l = ((#<package bootstrap-binaries@0 gnu/packages/bootstrap.scm:212 7f191a8f5500> "out") ("/gnu/store/a7s2cq1by31wzqqas967x3g1si4wbj0…") …)
scheme@(guix-user) [1]> (define b (caar $2))
scheme@(guix-user) [1]> ,pp b
$3 = #<package bootstrap-binaries@0 gnu/packages/bootstrap.scm:212 7f191a8f5500>
scheme@(guix-user) [1]> (with-store store (package-derivation store b))
$4 = #<derivation /gnu/store/c6hgmfq0i4zgryqyl0ab1ms51fnrkmdv-bootstrap-binaries-0.drv => /gnu/store/5bdaayvl6cs8nrdivskz4dbrsy2m009c-bootstrap-binaries-0 7f1910e6a6e0>
scheme@(guix-user) [1]> (map $1 $2)
ice-9/boot-9.scm:1669:16: In procedure raise-exception:
Throw to key `match-error' with args `("match" "no matching pattern" #<derivation /gnu/store/c6hgmfq0i4zgryqyl0ab1ms51fnrkmdv-bootstrap-binaries-0.drv => /gnu/store/5bdaayvl6cs8nrdivskz4dbrsy2m009c-bootstrap-binaries-0 7fd8a7ac66e0>)'.

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guix-user) [2]> ,bt
In ice-9/boot-9.scm:
   222:17  4 (map1 ((#<package bootstrap-binaries@0 gnu/packages/bootstrap.scm:212 7fd8b150e500> "out") ("/gnu/store/a7s2cq1by31wzqqas967x…") …))
In guix/store.scm:
   1295:8  3 (call-with-build-handler #<procedure build-accumulator (continue store things mode)> _)
  2017:24  2 (run-with-store #<store-connection 256.99 7fd8a7ac6f50> #<procedure 7fd8a677e2a0 at guix/gexp.scm:691:8 (state)> #:guile-for-build …)
In guix/gexp.scm:
   693:18  1 (_ _)
In ice-9/boot-9.scm:
  1669:16  0 (raise-exception _ #:continuable? _)
scheme@(guix-user) [2]> ,locals
  Local variables:
  $5 = closure = #<procedure raise-exception (exn #:key continuable?)>
scheme@(guix-user) [2]> ,fr 4
In ice-9/boot-9.scm:
   222:17  4 (map1 ((#<package bootstrap-binaries@0 gnu/packages/bootstrap.scm:212 7fd8b150e500> "out") ("/gnu/store/a7s2cq1by31wzqqas967x…") …))
scheme@(guix-user) [2]> ,locals
  Local variables:
  $6 = closure = #<procedure 7fd8a7adf090 at guix/store.scm:1337:9 (obj)>
  $7 = l = ((#<package bootstrap-binaries@0 gnu/packages/bootstrap.scm:212 7fd8b150e500> "out") ("/gnu/store/a7s2cq1by31wzqqas967x3g1si4wbj0…") …)
scheme@(guix-user) [2]> ($6 (car $7))
ice-9/boot-9.scm:1669:16: In procedure raise-exception:
Throw to key `match-error' with args `("match" "no matching pattern" #<derivation /gnu/store/c6hgmfq0i4zgryqyl0ab1ms51fnrkmdv-bootstrap-binaries-0.drv => /gnu/store/5bdaayvl6cs8nrdivskz4dbrsy2m009c-bootstrap-binaries-0 7fd8a7ac66e0>)'.

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guix-user) [3]> ,bt
In guix/store.scm:
   1295:8  3 (call-with-build-handler #<procedure build-accumulator (continue store things mode)> _)
  2017:24  2 (run-with-store #<store-connection 256.99 7fd8a7ac6f50> #<procedure 7fd8a6ab0280 at guix/gexp.scm:691:8 (state)> #:guile-for-build …)
In guix/gexp.scm:
   693:18  1 (_ _)
In ice-9/boot-9.scm:
  1669:16  0 (raise-exception _ #:continuable? _)
scheme@(guix-user) [3]> ,fr 3
In guix/store.scm:
   1295:8  3 (call-with-build-handler #<procedure build-accumulator (continue store things mode)> _)
scheme@(guix-user) [3]> ,locals
  Local variables:
  $8 = closure = #<variable 7fd8b321a830 value: #<<parameter> 7fd8b3232ac0 proc: #<procedure 7fd8b321b2a0 at ice-9/boot-9.scm:1299:5 () | (x)>>>
  $9 = handler = #<procedure build-accumulator (continue store things mode)>
scheme@(guix-user) [3]> ,fr 2
In guix/store.scm:
  2017:24  2 (run-with-store #<store-connection 256.99 7fd8a7ac6f50> #<procedure 7fd8a6ab0280 at guix/gexp.scm:691:8 (state)> #:guile-for-build …)
scheme@(guix-user) [3]> ,locals
  Local variables:
  $10 = closure = #<procedure run-with-store (store mval #:key guile-for-build system target)>
  $11 = store = #<store-connection 256.99 7fd8a7ac6f50>
  $12 = mval = #<procedure 7fd8a6ab0280 at guix/gexp.scm:691:8 (state)>
  $13 = t-10a3c941d34314a1-5734 = #<<parameter> 7fd8b36b7780 proc: #<procedure 7fd8b36be1e0 at ice-9/boot-9.scm:1299:5 () | (x)>>
  $14 = word = 0
  $15 = t-10a3c941d34314a1-573e = #<fluid 7fd8b36c52b0>
  $16 = mask = 4
While executing meta-command:
In procedure frame-local-ref: Wrong type argument in position 3: ptr
scheme@(guix-user) [3]> (car $7)
$17 = (#<package bootstrap-binaries@0 gnu/packages/bootstrap.scm:212 7fd8b150e500> "out")
scheme@(guix-user) [3]> $6
$18 = #<procedure 7fd8a7adf090 at guix/store.scm:1337:9 (obj)>
--8<---------------cut here---------------end--------------->8---

Bah, I have not idea.  Does it come from

--8<---------------cut here---------------start------------->8---
(define (map/accumulate-builds store proc lst)
  "Apply PROC over each element of LST, accumulating 'build-things' calls and
coalescing them into a single call."
  (define result
    (map (lambda (obj)
           (with-build-handler build-accumulator
             (proc obj)))
         lst))
[...]
--8<---------------cut here---------------end--------------->8---

where line 1337 is the one with ’(map (lambda (obj)’?

Well, it is weird, isn’t?  I am lacking some magical trick to
investigate more.  Any ideas?

Cheers,
simon