Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

importing an empty yaml file as a list panics #2721

Closed
uhthomas opened this issue Dec 3, 2023 · 4 comments
Closed

importing an empty yaml file as a list panics #2721

uhthomas opened this issue Dec 3, 2023 · 4 comments

Comments

@uhthomas
Copy link
Contributor

uhthomas commented Dec 3, 2023

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

$ cue version

e1ceed4

Does this issue reproduce with the latest stable release?

Yes.

What did you do?

❯ touch empty.yaml
❯ cue import --list empty.yaml
panic: unreachable [recovered]
        panic: unreachable

goroutine 1 [running]:
cuelang.org/go/cmd/cue/cmd.recoverError(0xc0004fbe78)
        cuelang.org/go/cmd/cue/cmd/root.go:318 +0x76
panic({0x56236702db60?, 0x56236714b500?})
        runtime/panic.go:914 +0x21f
cuelang.org/go/cmd/cue/cmd.placeOrphans(0xc000299790, 0xc0001d5290, {0x0, 0x0}, {0x0, 0x0, 0x0?})
        cuelang.org/go/cmd/cue/cmd/orphans.go:299 +0xe3d
cuelang.org/go/cmd/cue/cmd.(*buildPlan).placeOrphans(0xc000299790, 0xc0002ca780, {0xc000120170, 0x1, 0x5623666a1488?})
        cuelang.org/go/cmd/cue/cmd/orphans.go:141 +0x5ad
cuelang.org/go/cmd/cue/cmd.parseArgs(0xc000428750, {0xc00041f180, 0x1, 0x2}, 0xc00034edc0)
        cuelang.org/go/cmd/cue/cmd/common.go:655 +0xfac
cuelang.org/go/cmd/cue/cmd.runImport(0xc000428750?, {0xc00041f180, 0x1, 0x2})
        cuelang.org/go/cmd/cue/cmd/import.go:314 +0x786
cuelang.org/go/cmd/cue/cmd.newImportCmd.mkRunE.func1(0xc000434600?, {0xc00041f180, 0x1, 0x2})
        cuelang.org/go/cmd/cue/cmd/root.go:87 +0xab
github.com/spf13/cobra.(*Command).execute(0xc000437200, {0xc00041f160, 0x2, 0x2})
        github.com/spf13/cobra@v1.7.0/command.go:940 +0x87c
github.com/spf13/cobra.(*Command).ExecuteC(0xc000005200)
        github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.7.0/command.go:992
cuelang.org/go/cmd/cue/cmd.(*Command).Run(0xc000428750, {0x3?, 0x3?})
        cuelang.org/go/cmd/cue/cmd/root.go:303 +0x65
cuelang.org/go/cmd/cue/cmd.Main()
        cuelang.org/go/cmd/cue/cmd/root.go:231 +0x72
main.main()
        cuelang.org/go/cmd/cue/main.go:24 +0x13

What did you expect to see?

An empty list.

empty.cue
[]

What did you see instead?

See above.

@uhthomas uhthomas added NeedsInvestigation Triage Requires triage/attention labels Dec 3, 2023
@mvdan
Copy link
Member

mvdan commented Dec 3, 2023

Duplicate of #1790 and possibly #2714 too, I think.

@mvdan mvdan closed this as not planned Won't fix, can't repro, duplicate, stale Dec 3, 2023
@mvdan
Copy link
Member

mvdan commented Dec 3, 2023

Hm, I actually take that back for now, because the panic doesn't look the same. It might not be an exact duplicate.

@uhthomas
Copy link
Contributor Author

uhthomas commented Dec 3, 2023

Seems to be this:

panic("unreachable")

I can push a fix I think.

@uhthomas
Copy link
Contributor Author

uhthomas commented Dec 3, 2023

https://review.gerrithub.io/c/cue-lang/cue/+/1173072

@cueckoo cueckoo closed this as completed in b36b477 Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants