Skip to content

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

@audibleptr

Description

@audibleptr

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions