equinix-labs / equinix-labs/otel-cli
Segfault when trying to exec a non-existent path
- Dominant language
- Go
- Stars
- 716
- Forks
- 57
- PR merge metrics
- No merged PRs in 30d
Description
When using `exec ` otel-cli segfaults if `` doesn't exist:
```
$ otel-cli exec /bin/foobar
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x104dfc6f4]
goroutine 1 [running]:
github.com/equinix-labs/otel-cli/otelcli.doExec(0x14000224f00?, {0x140002a6ab0, 0x1, 0x1})
/home/atobey/src/otel-cli/otelcli/exec.go:149 +0xd54
github.com/spf13/cobra.(*Command).execute(0x140002d2600, {0x140002a6a80, 0x1, 0x1})
/home/atobey/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987 +0x814
github.com/spf13/cobra.(*Command).ExecuteC(0x1400022d500)
/home/atobey/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
/home/atobey/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/spf13/cobra.(*Command).ExecuteContext(...)
/home/atobey/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1032
github.com/equinix-labs/otel-cli/otelcli.Execute({0x1400026c2d0, 0x43})
/home/atobey/src/otel-cli/otelcli/root.go:89 +0x138
main.main()
/home/atobey/src/otel-cli/main.go:17 +0x50
```
I'm running 0.4.5.
Contributor guide
Research direction
Start at otelcli/exec.go:149 and reproduce the failure with `otel-cli exec /bin/foobar` on version 0.4.5. Trace the non-existent-path error handling and verify the command reports an error without panicking or segfaulting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100