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

panic when removing line by hostname #3

Closed
areYouLazy opened this issue Jun 22, 2021 · 1 comment
Closed

panic when removing line by hostname #3

areYouLazy opened this issue Jun 22, 2021 · 1 comment

Comments

@areYouLazy
Copy link
Owner

Describe the bug
When removing a line using hostname, libhosty panic

To Reproduce
Steps to reproduce the behavior:

  1. Add a new line with hosty
  2. Delete that same line by hostname with hosty

Expected behavior
Line should be removed without errors

Screenshots

$ sudo hosty add 123.123.123.123 delta.dns
done
$ sudo hosty d delta
panic: runtime error: index out of range [13] with length 13

goroutine 1 [running]:
github.com/areYouLazy/libhosty.(*HostsFile).RemoveHostsFileLinesByHostnameAsRegexp(0xc000012b40, 0x0, 0x0)
	/home/emil/go/pkg/mod/github.com/are!you!lazy/libhosty@v1.0.0/libhosty.go:392 +0x3da
github.com/areYouLazy/hosty/cmd.glob..func4(0x729e40, 0xc00005c7c0, 0x1, 0x1)
	/home/emil/go/src/github.com/areYouLazy/hosty/cmd/delete.go:40 +0x3d2
github.com/spf13/cobra.(*Command).execute(0x729e40, 0xc00005c7a0, 0x1, 0x1, 0x729e40, 0xc00005c7a0)
	/home/emil/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:856 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0x729440, 0x0, 0xffffffff, 0xc00007e058)
	/home/emil/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
	/home/emil/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897
github.com/areYouLazy/hosty/cmd.Execute(...)
	/home/emil/go/src/github.com/areYouLazy/hosty/cmd/root.go:48
main.main()
	/home/emil/go/src/github.com/areYouLazy/hosty/main.go:8 +0x2e
@areYouLazy
Copy link
Owner Author

This is a libhosty issue. Reporting it to the proper repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant