-
-
Notifications
You must be signed in to change notification settings - Fork 52
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
aqua info
$ aqua info
{
"version": "2.35.0",
"commit_hash": "fa5874acd5de87ca9e52b0c2b310130fa020d305",
"os": "darwin",
"arch": "arm64",
"pwd": "/Users/(USER)/gitClones/terraformer",
"root_dir": "/Users/(USER)/.local/share/aquaproj-aqua",
"env": {},
"config_files": []
}
Overview
When running the command aqua remove {cmd}
for a command that exists in the system but is not defined in aqua.yaml, a nil panic occurs. This happens because the code attempts to reference findResult.Package
, which is nil
in this case, causing the panic.
aqua/pkg/controller/remove/remove.go
Line 167 in 9eff974
if err := c.removePackage(logE, param.RootDir, findResult.Package.PackageInfo); err != nil { |
findResult
is returned from controller/which/which.go
, where Package is nil in some case.
aqua/pkg/controller/which/which.go
Lines 50 to 54 in fc24ef9
if exePath := c.lookPath(c.osenv.Getenv("PATH"), exeName); exePath != "" { | |
return &FindResult{ | |
ExePath: exePath, | |
}, nil | |
} |
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x10281d5e0]
goroutine 1 [running]:
github.com/aquaproj/aqua/v2/pkg/controller/remove.(*Controller).removeCommands(0x14000310100, {0x102bdcd20, 0x1400012cb40}, 0x140004ee230, 0x1400001c6e0, {0x14000041740?, 0x14000310100?, 0x0?})
/home/runner/work/aqua/aqua/pkg/controller/remove/remove.go:166 +0x1d0
github.com/aquaproj/aqua/v2/pkg/controller/remove.(*Controller).Remove(0x14000310100, {0x102bdcd20, 0x1400012cb40}, 0x140004ee230, 0x1400001c6e0)
/home/runner/work/aqua/aqua/pkg/controller/remove/remove.go:41 +0x2d4
github.com/aquaproj/aqua/v2/pkg/cli.(*Runner).removeAction(0x14000100690, 0x14000316440)
/home/runner/work/aqua/aqua/pkg/cli/remove.go:87 +0x230
github.com/urfave/cli/v2.(*Command).Run(0x1400001c000, 0x14000316440, {0x14000314e20, 0x2, 0x2})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.4/command.go:276 +0x71c
github.com/urfave/cli/v2.(*Command).Run(0x1400001c420, 0x14000316100, {0x1400010c180, 0x3, 0x3})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.4/command.go:269 +0x918
github.com/urfave/cli/v2.(*App).RunContext(0x14000018000, {0x102bdcd20, 0x1400012cb40}, {0x1400010c180, 0x3, 0x3})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.4/app.go:333 +0x51c
github.com/aquaproj/aqua/v2/pkg/cli.(*Runner).Run(0x14000100690, {0x102bdcd20, 0x1400012cb40}, {0x1400010c180, 0x3, 0x3})
/home/runner/work/aqua/aqua/pkg/cli/runner.go:227 +0x28e4
main.core(0x140004ee230, 0x140001404a0)
/home/runner/work/aqua/aqua/cmd/aqua/main.go:56 +0x228
main.main()
/home/runner/work/aqua/aqua/cmd/aqua/main.go:30 +0x48
How to reproduce
aqua.yaml → deleted manually before executing command
$ aqua remove terraform
Debug output
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x10120d5e0]
goroutine 1 [running]:
github.com/aquaproj/aqua/v2/pkg/controller/remove.(*Controller).removeCommands(0x14000174180, {0x1015ccd20, 0x1400012c000}, 0x140001700e0, 0x140000f29a0, {0x14000113aa0?, 0x14000174180?, 0x0?})
/home/runner/work/aqua/aqua/pkg/controller/remove/remove.go:166 +0x1d0
github.com/aquaproj/aqua/v2/pkg/controller/remove.(*Controller).Remove(0x14000174180, {0x1015ccd20, 0x1400012c000}, 0x140001700e0, 0x140000f29a0)
/home/runner/work/aqua/aqua/pkg/controller/remove/remove.go:41 +0x2d4
github.com/aquaproj/aqua/v2/pkg/cli.(*Runner).removeAction(0x140001002d0, 0x1400012c540)
/home/runner/work/aqua/aqua/pkg/cli/remove.go:87 +0x230
github.com/urfave/cli/v2.(*Command).Run(0x140000f22c0, 0x1400012c540, {0x14000140e00, 0x2, 0x2})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.4/command.go:276 +0x71c
github.com/urfave/cli/v2.(*Command).Run(0x140000f26e0, 0x1400012c200, {0x1400010c180, 0x3, 0x3})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.4/command.go:269 +0x918
github.com/urfave/cli/v2.(*App).RunContext(0x14000496400, {0x1015ccd20, 0x1400012c000}, {0x1400010c180, 0x3, 0x3})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.4/app.go:333 +0x51c
github.com/aquaproj/aqua/v2/pkg/cli.(*Runner).Run(0x140001002d0, {0x1015ccd20, 0x1400012c000}, {0x1400010c180, 0x3, 0x3})
/home/runner/work/aqua/aqua/pkg/cli/runner.go:227 +0x28e4
main.core(0x140001700e0, 0x14000492260)
/home/runner/work/aqua/aqua/cmd/aqua/main.go:56 +0x228
main.main()
/home/runner/work/aqua/aqua/cmd/aqua/main.go:30 +0x48
Expected behaviour
panic should never happen
Actual behaviour
nil pointer panic occurs
Note
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working