When `aqua.yaml` does not contain `packages` field, `aqua g -i` errors with `SIGSEGV`
Closed this issue · 2 comments
sapphi-red commented
aqua info
$ aqua info
{
"version": "2.28.0",
"commit_hash": "ecd9e704110bf2f236b744cd6497ad50e1b52e47",
"os": "linux",
"arch": "amd64",
"pwd": "/home/(USER)",
"root_dir": "/home/(USER)/.local/share/aquaproj-aqua",
"env": {
"AQUA_GLOBAL_CONFIG": "/home/(USER)/.config/aquaproj-aqua/aqua.yaml:",
"AQUA_POLICY_CONFIG": "/home/(USER)/.config/aquaproj-aqua/policy.yaml:"
},
"config_files": []
}
Overview
When aqua.yaml
does not contain packages
field, aqua g -i
errors with SIGSEGV
.
How to reproduce
aqua.yaml
registries:
- type: standard
ref: v4.182.0
Executed command and output
$ mkdir foo
$ cd foo
$ nano aqua.yaml # copy the aqua.yaml above
$ aqua g -i aquaproj/example-go-slsa-provenance
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xac9fc1]
goroutine 1 [running]:
github.com/aquaproj/aqua/v2/pkg/controller/generate/output.appendPkgsNode(0x0, {0xed3140, 0xc000092900})
/home/runner/work/aqua/aqua/pkg/controller/generate/output/insert.go:48 +0x21
github.com/aquaproj/aqua/v2/pkg/controller/generate/output.updateASTFile({0xed30c0, 0xc000d91300}, {0xc0014c6208?, 0x1?, 0xc28b40?})
/home/runner/work/aqua/aqua/pkg/controller/generate/output/insert.go:73 +0xfa
github.com/aquaproj/aqua/v2/pkg/controller/generate/output.(*Outputter).generateInsert(0xc000091e40, {0xc0000281a0, 0x19}, {0xc0014c6208, 0x1, 0x1})
/home/runner/work/aqua/aqua/pkg/controller/generate/output/insert.go:33 +0x230
github.com/aquaproj/aqua/v2/pkg/controller/generate/output.(*Outputter).Output(0xc0004335e0?, 0xc000d90a40)
/home/runner/work/aqua/aqua/pkg/controller/generate/output/output.go:41 +0x1f5
github.com/aquaproj/aqua/v2/pkg/controller/generate.(*Controller).Generate(0xc0000ba360, {0xece700, 0xc000139d00}, 0xc0004335e0, 0xc0000b8580, {0xc000035b60, 0x1, 0x1})
/home/runner/work/aqua/aqua/pkg/controller/generate/generate.go:56 +0x20e
github.com/aquaproj/aqua/v2/pkg/cli.(*Runner).generateAction(0xc0001890e0, 0xc000022440)
/home/runner/work/aqua/aqua/pkg/cli/generate.go:189 +0x29c
github.com/urfave/cli/v2.(*Command).Run(0xc0000b4c60, 0xc000022440, {0xc0000b6480, 0x3, 0x3})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.2/command.go:276 +0x97d
github.com/urfave/cli/v2.(*Command).Run(0xc0000b82c0, 0xc000022140, {0xc000138040, 0x4, 0x4})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.2/command.go:269 +0xbb7
github.com/urfave/cli/v2.(*App).RunContext(0xc0000b0000, {0xece700, 0xc000139d00}, {0xc000138040, 0x4, 0x4})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.2/app.go:333 +0x58b
github.com/aquaproj/aqua/v2/pkg/cli.(*Runner).Run(0xc0001890e0, {0xece700, 0xc000139d00}, {0xc000138040, 0x4, 0x4})
/home/runner/work/aqua/aqua/pkg/cli/runner.go:221 +0x2b45
main.core(0xc0004335e0, 0xc000149680)
/home/runner/work/aqua/aqua/cmd/aqua/main.go:56 +0x25a
main.main()
/home/runner/work/aqua/aqua/cmd/aqua/main.go:30 +0x4c
Debug output
No response
Expected behaviour
Either
- No error happens
- An error that tells
packages
field is required- also it'd be nice to have a message that
aqua init
exists
- also it'd be nice to have a message that
Actual behaviour
SIGSEGV error happens.
Note
No response
suzuki-shunsuke commented
Thank you for your report.
suzuki-shunsuke commented
v2.28.1 is out 🎉
https://github.com/aquaproj/aqua/releases/tag/v2.28.1