Skip to content

Segfault when trying to exec a non-existent path #356

@shastah

Description

@shastah

When using exec <path> otel-cli segfaults if <path> 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/[email protected]/command.go:987 +0x814
github.com/spf13/cobra.(*Command).ExecuteC(0x1400022d500)
	/home/atobey/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
	/home/atobey/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039
github.com/spf13/cobra.(*Command).ExecuteContext(...)
	/home/atobey/go/pkg/mod/github.com/spf13/[email protected]/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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions