GNU bug report logs - #61885
`guix import go` fails outside of pre-inst-env

Previous Next

Package: guix;

Reported by: winter <at> winter.cafe

Date: Wed, 1 Mar 2023 03:43:02 UTC

Severity: normal

Done: Tobias Geerinckx-Rice <me <at> tobias.gr>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61885 in the body.
You can then email your comments to 61885 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#61885; Package guix. (Wed, 01 Mar 2023 03:43:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to winter <at> winter.cafe:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Wed, 01 Mar 2023 03:43:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: winter <at> winter.cafe
To: bug-guix <at> gnu.org
Subject: `guix import go` fails outside of pre-inst-env
Date: Tue, 28 Feb 2023 22:42:38 -0500
Hi,

As of commit ec8c7370dfd66136f7cb517d31fa6fda31e2cb74, the following `guix import` invocation fails:

$ guix import go --recursive github.com/tdewolff/minify/v2
Backtrace:
In ice-9/boot-9.scm:
  222:29 19 (map1 _)
  222:29 18 (map1 _)
  222:29 17 (map1 _)
  222:29 16 (map1 _)
  222:29 15 (map1 _)
  222:29 14 (map1 _)
  222:29 13 (map1 _)
  222:29 12 (map1 _)
  222:29 11 (map1 _)
  222:17 10 (map1 (((gnu packages check)) ((gnu packages #)) ((…)) …))
 3327:17  9 (resolve-interface (gnu packages check) #:select _ # _ # …)
In ice-9/threads.scm:
   390:8  8 (_ _)
In ice-9/boot-9.scm:
 3253:13  7 (_)
In ice-9/threads.scm:
   390:8  6 (_ _)
In ice-9/boot-9.scm:
 3544:20  5 (_)
  2836:4  4 (save-module-excursion _)
 3564:26  3 (_)
In unknown file:
          2 (primitive-load-path "gnu/packages/check" #<procedure a…>)
In gnu/packages/check.scm:
 1037:13  1 (_)
In ice-9/boot-9.scm:
 1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
error: go-github-com-robfig-cron: unbound variable

Strangely enough, it does work inside pre-inst-env with that same commit:

$ ./pre-inst-env guix import go --recursive github.com/tdewolff/minify/v2
(define-public go-github-com-djherbis-atime
<...>

I'm very unsure as to why this is happening, as `(gnu packages golang)` is imported in `(gnu packages check)`. Plus, even more weirdly, `guix build` can't find the problematic package, but can build the one that depends on it:

$ guix build go-github-com-robfig-cron-1.2
guix build: error: go-github-com-robfig-cron-1.2: unknown package
$ guix build actionlint
/gnu/store/0nzn1lbq02mfp6ka7z34lp9ly5nhlrv4-actionlint-1.6.23

I'd appreciate any help tracking down what could possibly be wrong here, as it's very puzzling.

Thanks,
Winter



Information forwarded to bug-guix <at> gnu.org:
bug#61885; Package guix. (Wed, 01 Mar 2023 09:48:02 GMT) Full text and rfc822 format available.

Message #8 received at 61885 <at> debbugs.gnu.org (full text, mbox):

From: Josselin Poiret <dev <at> jpoiret.xyz>
To: winter <at> winter.cafe, 61885 <at> debbugs.gnu.org
Subject: Re: bug#61885: `guix import go` fails outside of pre-inst-env
Date: Wed, 01 Mar 2023 10:47:07 +0100
[Message part 1 (text/plain, inline)]
Hi,

winter--- via Bug reports for GNU Guix <bug-guix <at> gnu.org> writes:

> Hi,
>
> As of commit ec8c7370dfd66136f7cb517d31fa6fda31e2cb74, the following `guix import` invocation fails:
>
> $ guix import go --recursive github.com/tdewolff/minify/v2
> [...]
> In gnu/packages/check.scm:
>  1037:13  1 (_)
> In ice-9/boot-9.scm:
>  1685:16  0 (raise-exception _ #:continuable? _)
>
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> error: go-github-com-robfig-cron: unbound variable

This is way worse: (gnu packages golang) cannot be loaded at all!
This is caused by a cycle, (gnu packages golang) uses (gnu packages
check) and vice-versa, and go-github-com-robfig-cron is defined in (gnu
packages golang)! So depending on whether you first use (gnu packages
check) or (gnu packages golang), go-github-com-robfig-cron will not have
been defined yet, hence the error.

Using (gnu packages check) then (gnu packages golang) doesn't make the
error appear.  The solution imo, esp. since (gnu packages check) already
uses (gnu packages golang), is to have the variant package defined
alongside the parent. Here is a patch that should fix this.

Best,
-- 
Josselin Poiret
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#61885; Package guix. (Wed, 01 Mar 2023 09:49:02 GMT) Full text and rfc822 format available.

Message #11 received at 61885 <at> debbugs.gnu.org (full text, mbox):

From: Josselin Poiret <dev <at> jpoiret.xyz>
To: Josselin Poiret <dev <at> jpoiret.xyz>, winter <at> winter.cafe,
 61885 <at> debbugs.gnu.org
Subject: [PATCH] gnu: go-github-com-robfig-cron-1.2: Move to (gnu packages
 golang)
Date: Wed,  1 Mar 2023 10:48:35 +0100
Becaus (gnu packages golang) and (gnu packages check) use each other, this
avoids an undefined symbol.

* gnu/packages/check.scm (go-github-com-robfig-cron-1.2): Move to...
* gnu/packages/golang.scm (go-github-com-robfig-cron-1.2): ...here.
---
 gnu/packages/check.scm  | 18 ------------------
 gnu/packages/golang.scm | 18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index 4e907afeb6..44860e3018 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -1029,24 +1029,6 @@ (define-public cpputest
 but it works for any C/C++ project.")
     (license license:bsd-3)))
 
-;; Required by actionlint. The version of `go-github-com-robfig-cron'
-;; packaged in Guix is newer and changed some error messages, causing
-;; unit tests in actionlint to fail.
-(define-public go-github-com-robfig-cron-1.2
-  (package
-    (inherit go-github-com-robfig-cron)
-    (name "go-github-com-robfig-cron")
-    (version "1.2.0")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://github.com/robfig/cron")
-                    (commit (string-append "v" version))))
-              (file-name (git-file-name name version))
-              (sha256
-               (base32
-                "0nv31m3940d9kf38lw2zs4hpj435bdi9mmim098rb3n4l07qrvva"))))))
-
 (define-public actionlint
   (package
     (name "actionlint")
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 7268b661cf..465e0fd4c7 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -6882,6 +6882,24 @@ (define-public go-github-com-robfig-cron
 a cron spec parser and job runner.")
     (license license:expat)))
 
+;; Required by actionlint. The version of `go-github-com-robfig-cron'
+;; packaged in Guix is newer and changed some error messages, causing
+;; unit tests in actionlint to fail.
+(define-public go-github-com-robfig-cron-1.2
+  (package
+    (inherit go-github-com-robfig-cron)
+    (name "go-github-com-robfig-cron")
+    (version "1.2.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/robfig/cron")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0nv31m3940d9kf38lw2zs4hpj435bdi9mmim098rb3n4l07qrvva"))))))
+
 (define-public go-github-com-shirou-gopsutil
   (let ((commit "47ef3260b6bf6ead847e7c8fc4101b33c365e399")
         (revision "0"))

base-commit: 307d1b626be86ed21d48d44a131ce8490f370a17
-- 
2.39.1





Information forwarded to bug-guix <at> gnu.org:
bug#61885; Package guix. (Wed, 01 Mar 2023 10:46:02 GMT) Full text and rfc822 format available.

Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: Josselin Poiret via Bug reports for GNU Guix <bug-guix <at> gnu.org>,
 Josselin Poiret <dev <at> jpoiret.xyz>, winter <at> winter.cafe,
 61885 <at> debbugs.gnu.org
Subject: Re: bug#61885: [PATCH] gnu: go-github-com-robfig-cron-1.2: Move to
 (gnu packages golang)
Date: Wed, 01 Mar 2023 11:40:39 +0100
Hi,

On mer., 01 mars 2023 at 10:48, Josselin Poiret via Bug reports for GNU Guix <bug-guix <at> gnu.org> wrote:
> Becaus (gnu packages golang) and (gnu packages check) use each other, this
      -^
   Typo

s/Becaus/Because I guess

> avoids an undefined symbol.
>
> * gnu/packages/check.scm (go-github-com-robfig-cron-1.2): Move to...
> * gnu/packages/golang.scm (go-github-com-robfig-cron-1.2): ...here.
> ---

Well, I have not given a look at this though. :-)

Cheers,
simon




Information forwarded to bug-guix <at> gnu.org:
bug#61885; Package guix. (Wed, 01 Mar 2023 10:46:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#61885; Package guix. (Wed, 01 Mar 2023 17:35:01 GMT) Full text and rfc822 format available.

Message #20 received at 61885 <at> debbugs.gnu.org (full text, mbox):

From: Winter <winter <at> winter.cafe>
To: Josselin Poiret <dev <at> jpoiret.xyz>
Cc: 61885 <at> debbugs.gnu.org
Subject: Re: bug#61885: `guix import go` fails outside of pre-inst-env
Date: Wed, 1 Mar 2023 12:34:07 -0500
Hi,

> This is way worse: (gnu packages golang) cannot be loaded at all!
> This is caused by a cycle, (gnu packages golang) uses (gnu packages
> check) and vice-versa, and go-github-com-robfig-cron is defined in (gnu
> packages golang)! So depending on whether you first use (gnu packages
> check) or (gnu packages golang), go-github-com-robfig-cron will not have
> been defined yet, hence the error.

Great catch, thank you!

I still wonder what about pre-inst-env makes it so the order is different -- it's still the same code importing it, after all.

Also, just for posterity: I ran into a situation where I was only able to reproduce this from within a Guix shell, though that may be some oddities with regards to the shell caching symlinks in PATH(?)

I'll try to look into at least the latter issue, no clue what's up with pre-inst-env, though.

Thanks,
Winter



Information forwarded to bug-guix <at> gnu.org:
bug#61885; Package guix. (Wed, 01 Mar 2023 17:54:02 GMT) Full text and rfc822 format available.

Message #23 received at 61885 <at> debbugs.gnu.org (full text, mbox):

From: Winter <winter <at> winter.cafe>
To: Josselin Poiret <dev <at> jpoiret.xyz>
Cc: 61885 <at> debbugs.gnu.org
Subject: Re: bug#61885: `guix import go` fails outside of pre-inst-env
Date: Wed, 1 Mar 2023 12:52:51 -0500
> Using (gnu packages check) then (gnu packages golang) doesn't make the
> error appear.  The solution imo, esp. since (gnu packages check) already
> uses (gnu packages golang), is to have the variant package defined
> alongside the parent. Here is a patch that should fix this.

To clarify: I do think this is the best solution, though the oddities I mentioned may warrant further investigation into potentially different issues.

In addition to those, I wonder why `guix build` shows that the cyclic package can't be found, rather than throwing an error as `guix import` does. Maybe it's worth fixing that, if possible, to not cause (worse) confusion?

Thanks,
Winter



Information forwarded to bug-guix <at> gnu.org:
bug#61885; Package guix. (Wed, 01 Mar 2023 21:06:01 GMT) Full text and rfc822 format available.

Message #26 received at 61885 <at> debbugs.gnu.org (full text, mbox):

From: Josselin Poiret <dev <at> jpoiret.xyz>
To: Winter <winter <at> winter.cafe>
Cc: 61885 <at> debbugs.gnu.org
Subject: Re: bug#61885: `guix import go` fails outside of pre-inst-env
Date: Wed, 01 Mar 2023 22:04:54 +0100
[Message part 1 (text/plain, inline)]
Hi again,

Winter <winter <at> winter.cafe> writes:

> In addition to those, I wonder why `guix build` shows that the cyclic package can't be found, rather than throwing an error as `guix import` does. Maybe it's worth fixing that, if possible, to not cause (worse) confusion?

This is because you should be trying to build
`go-github-com-robfig-cron <at> 1.2`, not `go-github-com-robfig-cron-1.2`!

`guix build` takes specifications, not Guile variable names.

Best,
-- 
Josselin Poiret
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#61885; Package guix. (Thu, 02 Mar 2023 15:12:02 GMT) Full text and rfc822 format available.

Message #29 received at 61885 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Josselin Poiret <dev <at> jpoiret.xyz>, 61911 <at> debbugs.gnu.org,
 61885 <at> debbugs.gnu.org
Cc: Julien Lepiller <julien <at> lepiller.eu>
Subject: Re: bug#61911: error: mate-polkit: unbound variable
Date: Thu, 2 Mar 2023 16:11:05 +0100
[Message part 1 (text/plain, inline)]

Op 02-03-2023 om 15:36 schreef Josselin Poiret:
> Hi Maxime,
> 
> Maxime Devos <maximedevos <at> telenet.be> writes:
> 
>> In unknown file:
>>              3 (primitive-load-path "gnu/packages/xfce" #<procedure 7f?>)
>> In gnu/packages/xfce.scm:
>>     1156:19  2 (_)
>> In ice-9/boot-9.scm:
>>     1685:16  1 (raise-exception _ #:continuable? _)
>>     1685:16  0 (raise-exception _ #:continuable? _)
>>
>> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
>> error: mate-polkit: unbound variable
> 
> This is the same kind of issue as [1]: both xfce and mate require each
> other (the second through mate -> freedesktop -> kde-frameworks ->
> kde-plasma -> display-managers -> xfce), and depending on the order in
> which they're loaded, mate-polkit-for-xfce might get defined before
> mate-polkit is.  The solution I suggested there was to define the
> variant in the same file as the original package, but here I'm not sure
> if this is the right call.
> 
> In general, I'd much rather try to get rid of those pesky module cycles,
> as they cause general headaches for guix pull.  I remember Julien
> using (guix modules) to do some analysis at the Guix days, maybe we
> could get some pointers on how to handle this specific situation?
> 
> WDYT?
> 
> [1] https://issues.guix.gnu.org/61885
>     (mid: F29B8BFE-A175-4128-8093-4A810681E235 <at> winter.cafe)

I haven't gone to Guix days so I can't comment on that, but I'd like to 
note that there are some simple patches for breaking up lots of package 
cycles at <https://issues.guix.gnu.org/54539#62> (*).  In particular, 
#:use-module -> #:autoload appears promising (^).

Basically, you can consider a module reference to be 'strong' if its of 
the form (define stuff (package (inherit reference)) ...), and 'weak' if 
its just a package input (or more generally, something thunked). 
'Strong' cycles are problematic, but 'weak' cycles should be resolvable 
by delaying loading the required modules until needed.

I don't know if these patches would solve this particular 'mate-polkit' 
issue -- if the 'mate -> freedesktop -> ... -> xfce' cycle is 'weak', 
something like those patches should work, but if it isn't, those patches 
would be insufficient.

(*) Beware of https://issues.guix.gnu.org/54539#63 though; looks like I 
made some mistakes in hurd.scm and image.scm.

Greetings,
Maxime.
[OpenPGP_0x49E3EE22191725EE.asc (application/pgp-keys, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

Reply sent to Tobias Geerinckx-Rice <me <at> tobias.gr>:
You have taken responsibility. (Thu, 02 Mar 2023 22:33:01 GMT) Full text and rfc822 format available.

Notification sent to winter <at> winter.cafe:
bug acknowledged by developer. (Thu, 02 Mar 2023 22:33:02 GMT) Full text and rfc822 format available.

Message #34 received at 61885-done <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: winter <at> winter.cafe
Cc: 61885-done <at> debbugs.gnu.org
Subject: Re: bug#61885: [PATCH] gnu: go-github-com-robfig-cron-1.2: Move to
 (gnu packages golang)
Date: Thu, 02 Mar 2023 23:31:13 +0100
[Message part 1 (text/plain, inline)]
Hi Winter,

Simon Tournier 写道:
>> Becaus (gnu packages golang) and (gnu packages check) use each 
>> other, this
>       -^
>    Typo
>
> s/Becaus/Because I guess

Pushed as 997b93cc4a6deff54ebd854a716cca94095114bf with this fix. 
Thanks!

I'll close this bug now; the more general problem (and more 
work-arounds to it) are tracked in others.

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 31 Mar 2023 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 25 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.