cue-lang / cue

The home of the CUE language! Validate and define text-based and dynamic configuration
https://cuelang.org
Apache License 2.0
5.11k stars 291 forks source link

`Cue eval` hangs on cyclic package imports #2652

Open movatechtoday opened 1 year ago

movatechtoday commented 1 year ago

What version of CUE are you using (cue version)?

$ cue version

cue version v0.6.0

go version go1.20.3
      -buildmode exe
       -compiler gc
     CGO_ENABLED 1
          GOARCH amd64
            GOOS linux
         GOAMD64 v1

Does this issue reproduce with the latest stable release?

Yes

What did you do?

I create a module with the following structure.

.
├── cue.mod
│   └── module.cue
└── main
    ├── libs.cue
    └── main.cue

module.cue

module: "cuefy.today/tests"

main/libs.cue

package libs

field: "field"

main/main.cue

package main

import (
    "cuefy.today/tests/main:libs"
    "cuefy.today/tests/main"
)

field_001: libs.field   // <-- import from the libs package
field_main: "field_main"
field_main_ref: main.field_main // <-- import from the main package

I mistakenly created a cycle inside the main package to the main package.

And run the following command:

 cue eval main/main.cue 

What did you expect to see?

After running the following commad:

 cue eval main/main.cue 

I would like to see an error message that a cycle detected.

What did you see instead?

cue eval hangs

mvdan commented 1 year ago

Have you tried master? This sounds like a variation of #849, which was fixed shortly after our last stable release.

movatechtoday commented 1 year ago

No, I tried the latest stable version. Let me check with on the master branch