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

bbolt CLI util panics / shows not-user-friendly errors in certain cases with incorrect (number of) arguments #681

Closed
audibleptr opened this issue Jan 29, 2024 · 3 comments · Fixed by #682

Comments

@audibleptr
Copy link

I see there's lots of issues about panics, but I think this one is different, as it relates to the CLI util, rather than the library.

For at least several commands, the CLI utility doesn't properly handle missing arguments, resorting to various panics and errors, rather than printing useful error messages to the user.

For example:

$ bbolt get
panic: runtime error: slice bounds out of range [:-1]

goroutine 1 [running]:
main.(*getCommand).Run(0xc00006cdc8, {0xc000014070, 0x0, 0x0})
        /usr/src/RPM/BUILD/bbolt-1.3.8/cmd/bbolt/main.go:996 +0x699
main.(*Main).Run(0xc00006cf40, {0xc000014070?, 0x7f66b3c44108?, 0x60?})
        /usr/src/RPM/BUILD/bbolt-1.3.8/cmd/bbolt/main.go:123 +0x10d
main.main()
        /usr/src/RPM/BUILD/bbolt-1.3.8/cmd/bbolt/main.go:67 +0xae
$ bbolt page-item test.db 4
strconv.ParseUint: parsing "": invalid syntax

The DB itself is valid, and with correct arguments bbolt returns correct results.

bbolt 1.3.8-alt1 on ALT Linux

@ahrtr
Copy link
Member

ahrtr commented Jan 29, 2024

Thanks for raising this issue.

@Elbehery could you fix this issue, and backport it to release-1.3?

@Elbehery
Copy link
Member

sure, on it 👍🏽

@Elbehery
Copy link
Member

raised backport-1.3 at #683

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants