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

[Bug]: Attach process by name index out of range #1067

Closed
michalbiesek opened this issue Aug 9, 2022 · 0 comments · Fixed by #1068
Closed

[Bug]: Attach process by name index out of range #1067

michalbiesek opened this issue Aug 9, 2022 · 0 comments · Fixed by #1068
Assignees
Labels
bug Something isn't working
Milestone

Comments

@michalbiesek
Copy link
Contributor

Steps To Reproduce

docker run --privileged --rm -it cribl/scope:dev-x86_64
top &
top &
scope attach top
Found multiple processes matching that name...
ID	PID	USER	SCOPED	COMMAND
1 	16 	root	false 	top
2 	17 	root	false 	top
Select an ID from the list:

When choosing 3

3
panic: runtime error: index out of range [2] with length 2

goroutine 1 [running]:
github.com/criblio/scope/run.choosePid({0xc000424460, 0x2, 0xc0000dfb60?})
	/home/michalbiesek/Github/appscope/cli/run/attach.go:119 +0x296
github.com/criblio/scope/run.(*Config).Attach(0x2a71d00, {0xc0003c3560, 0x1, 0x1})
	/home/michalbiesek/Github/appscope/cli/run/attach.go:47 +0x315
github.com/criblio/scope/cmd.glob..func1(0x2a44180?, {0xc0003c3560, 0x1, 0x1})
	/home/michalbiesek/Github/appscope/cli/cmd/attach.go:80 +0x4c5
github.com/spf13/cobra.(*Command).execute(0x2a44180, {0xc0003c3540, 0x1, 0x1})
	/home/michalbiesek/Github/appscope/cli/.gomod/github.com/spf13/cobra@v1.1.1/command.go:854 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x2a43ee0)
	/home/michalbiesek/Github/appscope/cli/.gomod/github.com/spf13/cobra@v1.1.1/command.go:958 +0x39c
github.com/spf13/cobra.(*Command).Execute(...)
	/home/michalbiesek/Github/appscope/cli/.gomod/github.com/spf13/cobra@v1.1.1/command.go:895
github.com/criblio/scope/cmd.Execute()
	/home/michalbiesek/Github/appscope/cli/cmd/root.go:23 +0x45
main.main()
	/home/michalbiesek/Github/appscope/cli/main.go:19 +0xb4

Environment

- AppScope: 1.1.0
- OS: Ubuntu 18.04
- Architecture:x86_64/aarch64

Requested priority

Low

Relevant log output

No response

@michalbiesek michalbiesek added the bug Something isn't working label Aug 9, 2022
@michalbiesek michalbiesek self-assigned this Aug 9, 2022
michalbiesek added a commit that referenced this issue Aug 9, 2022
- provide exit status message without panic

Closes #1067
@jrcheli jrcheli added this to the Next Maintenance (1.1.3) milestone Aug 11, 2022
jrcheli added a commit that referenced this issue Aug 11, 2022
(#1067) Fix attach process by name error: index out of range
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants