unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#61885: `guix import go` fails outside of pre-inst-env
@ 2023-03-01  3:42 winter--- via Bug reports for GNU Guix
  2023-03-01  9:47 ` Josselin Poiret via Bug reports for GNU Guix
  0 siblings, 1 reply; 8+ messages in thread
From: winter--- via Bug reports for GNU Guix @ 2023-03-01  3:42 UTC (permalink / raw)
  To: 61885

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



^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#61885: `guix import go` fails outside of pre-inst-env
  2023-03-01  3:42 bug#61885: `guix import go` fails outside of pre-inst-env winter--- via Bug reports for GNU Guix
@ 2023-03-01  9:47 ` Josselin Poiret via Bug reports for GNU Guix
  2023-03-01  9:48   ` bug#61885: [PATCH] gnu: go-github-com-robfig-cron-1.2: Move to (gnu packages golang) Josselin Poiret via Bug reports for GNU Guix
                     ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Josselin Poiret via Bug reports for GNU Guix @ 2023-03-01  9:47 UTC (permalink / raw)
  To: winter, 61885

[-- Attachment #1: Type: text/plain, Size: 1205 bytes --]

Hi,

winter--- via Bug reports for GNU Guix <bug-guix@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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 682 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#61885: [PATCH] gnu: go-github-com-robfig-cron-1.2: Move to (gnu packages golang)
  2023-03-01  9:47 ` Josselin Poiret via Bug reports for GNU Guix
@ 2023-03-01  9:48   ` Josselin Poiret via Bug reports for GNU Guix
  2023-03-01 10:40     ` Simon Tournier
  2023-03-01 17:34   ` bug#61885: `guix import go` fails outside of pre-inst-env Winter via Bug reports for GNU Guix
  2023-03-01 17:52   ` Winter via Bug reports for GNU Guix
  2 siblings, 1 reply; 8+ messages in thread
From: Josselin Poiret via Bug reports for GNU Guix @ 2023-03-01  9:48 UTC (permalink / raw)
  To: Josselin Poiret, winter, 61885

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





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#61885: [PATCH] gnu: go-github-com-robfig-cron-1.2: Move to (gnu packages golang)
  2023-03-01  9:48   ` bug#61885: [PATCH] gnu: go-github-com-robfig-cron-1.2: Move to (gnu packages golang) Josselin Poiret via Bug reports for GNU Guix
@ 2023-03-01 10:40     ` Simon Tournier
  2023-03-02 22:31       ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Tournier @ 2023-03-01 10:40 UTC (permalink / raw)
  To: 61885, dev, winter

Hi,

On mer., 01 mars 2023 at 10:48, Josselin Poiret via Bug reports for GNU Guix <bug-guix@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




^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#61885: `guix import go` fails outside of pre-inst-env
  2023-03-01  9:47 ` Josselin Poiret via Bug reports for GNU Guix
  2023-03-01  9:48   ` bug#61885: [PATCH] gnu: go-github-com-robfig-cron-1.2: Move to (gnu packages golang) Josselin Poiret via Bug reports for GNU Guix
@ 2023-03-01 17:34   ` Winter via Bug reports for GNU Guix
  2023-03-01 17:52   ` Winter via Bug reports for GNU Guix
  2 siblings, 0 replies; 8+ messages in thread
From: Winter via Bug reports for GNU Guix @ 2023-03-01 17:34 UTC (permalink / raw)
  To: Josselin Poiret; +Cc: 61885

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



^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#61885: `guix import go` fails outside of pre-inst-env
  2023-03-01  9:47 ` Josselin Poiret via Bug reports for GNU Guix
  2023-03-01  9:48   ` bug#61885: [PATCH] gnu: go-github-com-robfig-cron-1.2: Move to (gnu packages golang) Josselin Poiret via Bug reports for GNU Guix
  2023-03-01 17:34   ` bug#61885: `guix import go` fails outside of pre-inst-env Winter via Bug reports for GNU Guix
@ 2023-03-01 17:52   ` Winter via Bug reports for GNU Guix
  2023-03-01 21:04     ` Josselin Poiret via Bug reports for GNU Guix
  2 siblings, 1 reply; 8+ messages in thread
From: Winter via Bug reports for GNU Guix @ 2023-03-01 17:52 UTC (permalink / raw)
  To: Josselin Poiret; +Cc: 61885

> 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



^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#61885: `guix import go` fails outside of pre-inst-env
  2023-03-01 17:52   ` Winter via Bug reports for GNU Guix
@ 2023-03-01 21:04     ` Josselin Poiret via Bug reports for GNU Guix
  0 siblings, 0 replies; 8+ messages in thread
From: Josselin Poiret via Bug reports for GNU Guix @ 2023-03-01 21:04 UTC (permalink / raw)
  To: Winter; +Cc: 61885

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

Hi again,

Winter <winter@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@1.2`, not `go-github-com-robfig-cron-1.2`!

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

Best,
-- 
Josselin Poiret

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 682 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#61885: [PATCH] gnu: go-github-com-robfig-cron-1.2: Move to (gnu packages golang)
  2023-03-01 10:40     ` Simon Tournier
@ 2023-03-02 22:31       ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
  0 siblings, 0 replies; 8+ messages in thread
From: Tobias Geerinckx-Rice via Bug reports for GNU Guix @ 2023-03-02 22:31 UTC (permalink / raw)
  To: winter; +Cc: 61885-done

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-03-02 22:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-01  3:42 bug#61885: `guix import go` fails outside of pre-inst-env winter--- via Bug reports for GNU Guix
2023-03-01  9:47 ` Josselin Poiret via Bug reports for GNU Guix
2023-03-01  9:48   ` bug#61885: [PATCH] gnu: go-github-com-robfig-cron-1.2: Move to (gnu packages golang) Josselin Poiret via Bug reports for GNU Guix
2023-03-01 10:40     ` Simon Tournier
2023-03-02 22:31       ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2023-03-01 17:34   ` bug#61885: `guix import go` fails outside of pre-inst-env Winter via Bug reports for GNU Guix
2023-03-01 17:52   ` Winter via Bug reports for GNU Guix
2023-03-01 21:04     ` Josselin Poiret via Bug reports for GNU Guix

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).