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

Appending a Document to an empty Document Set panics #548

Open
pivotaljohn opened this issue Nov 19, 2021 · 1 comment
Open

Appending a Document to an empty Document Set panics #548

pivotaljohn opened this issue Nov 19, 2021 · 1 comment
Labels
bug This issue describes a defect or unexpected behavior priority/unprioritized-backlog Higher priority than priority/awaiting-more-evidence but not planned. Contributions are welcome.

Comments

@pivotaljohn
Copy link
Contributor

What steps did you take:

With this input (i.e. an overlay that appends a document):

#@overlay/match by=lambda: False
#@overlay/append
---
kind: Stuff

ran:

$ ytt -f .

What happened:

panic: runtime error: index out of range [-1]

goroutine 1 [running]:
github.com/k14s/ytt/pkg/yttlibrary/overlay.Op.appendDocument(...)
	github.com/k14s/ytt/pkg/yttlibrary/overlay/document.go:195
github.com/k14s/ytt/pkg/yttlibrary/overlay.Op.applyDocSet({{0x1469760, 0xc00000cb70}, {0x14f1640, 0xc0001a8cb0}, 0xc0001ea9b0, 0x0}, {0x1993b70, 0x1a7c101, 0x0}, 0xc0001a8cb0, ...)
	github.com/k14s/ytt/pkg/yttlibrary/overlay/op.go:155 +0x805
github.com/k14s/ytt/pkg/yttlibrary/overlay.Op.apply({{0x1469760, 0xc00000cb70}, {0x14f1640, 0xc0001a8cb0}, 0xc0001ea9b0, 0x0}, {0x1469760, 0xc00000cb88}, {0x14f1640, 0xc0001a8cb0}, ...)
	github.com/k14s/ytt/pkg/yttlibrary/overlay/op.go:55 +0x328
github.com/k14s/ytt/pkg/yttlibrary/overlay.Op.Apply({{0x1469760, 0xc00000cb70}, {0x14f1640, 0xc0001a8cb0}, 0xc0001ea9b0, 0x0})
	github.com/k14s/ytt/pkg/yttlibrary/overlay/op.go:27 +0x14f
github.com/k14s/ytt/pkg/workspace.OverlayPostProcessing.Apply({0xc000141a48})
	github.com/k14s/ytt/pkg/workspace/overlay_post_processing.go:63 +0x716
github.com/k14s/ytt/pkg/workspace.(*LibraryExecution).Eval(0xc000141a48, 0x0, {0x0, 0x0, 0x1659478}, {0x0, 0xc00007d960, 0x0})
	github.com/k14s/ytt/pkg/workspace/library_execution.go:191 +0x7b
github.com/k14s/ytt/pkg/cmd/template.(*Options).RunWithFiles(0xc00015e580, {{0xc00000e108, 0x2, 0x100c000141ae0}}, {0x165e748, 0xc0001a3380})
	github.com/k14s/ytt/pkg/cmd/template/cmd.go:158 +0x567
github.com/k14s/ytt/pkg/cmd/template.(*Options).Run(0xc00015e580)
	github.com/k14s/ytt/pkg/cmd/template/cmd.go:97 +0x4b1
github.com/k14s/ytt/pkg/cmd/template.NewCmd.func1(0x1359b85, {0xc00007e9a0, 0x0, 0x0})
	github.com/k14s/ytt/pkg/cmd/template/cmd.go:62 +0x1d
github.com/cppforlife/cobrautil.WrapRunEForCmd.func1.1(0xc00017c600, {0xc00007e9a0, 0x0, 0x2})
	github.com/cppforlife/cobrautil@v0.0.0-20200514214827-bb86e6965d72/misc.go:45 +0x6d
github.com/cppforlife/cobrautil.WrapRunEForCmd.func1.1(0xc000190a00, {0xc00007e9a0, 0x0, 0x2})
	github.com/cppforlife/cobrautil@v0.0.0-20200514214827-bb86e6965d72/misc.go:45 +0x6d
github.com/spf13/cobra.(*Command).execute(0xc000190a00, {0xc00001e1c0, 0x2, 0x2})
	github.com/spf13/cobra@v1.2.1/command.go:856 +0x60e
github.com/spf13/cobra.(*Command).ExecuteC(0xc000190a00)
	github.com/spf13/cobra@v1.2.1/command.go:974 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra@v1.2.1/command.go:902
main.main()
	github.com/k14s/ytt/cmd/ytt/ytt.go:21 +0xd6

What did you expect:
The document to be appended to the empty DocumentSet.

Anything else you would like to add:

Slack thread: https://kubernetes.slack.com/archives/CH8KCCKA5/p1637354198458400?thread_ts=1637349049.448900&cid=CH8KCCKA5

Environment:

  • ytt version (use ytt --version): v0.38.0

Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

@pivotaljohn pivotaljohn added bug This issue describes a defect or unexpected behavior priority/unprioritized-backlog Higher priority than priority/awaiting-more-evidence but not planned. Contributions are welcome. labels Nov 19, 2021
@pivotaljohn
Copy link
Contributor Author

This is an uncommon case that ought to be fixed: set priority accordingly.

@aaronshurley aaronshurley moved this to To Triage in Carvel Aug 18, 2022
@pivotaljohn pivotaljohn moved this from To Triage to Unprioritized in Carvel Sep 27, 2022
@github-project-automation github-project-automation bot moved this to To Triage in Carvel Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a defect or unexpected behavior priority/unprioritized-backlog Higher priority than priority/awaiting-more-evidence but not planned. Contributions are welcome.
Projects
Status: To Triage
Development

No branches or pull requests

1 participant