Description
What's the issue?
It looks like cbflag doesn't correctly handle abnormally large help strings correctly. When calculating the post message padding we're causing a panic because we're supplying a negative repeat count to 'strings.Repeat'.
james@ponos ~/Projects/couchbase-build/backup cbbackupmgr config -a ~/Projects/couchbase-archive -r repo -h
|
panic: strings: negative Repeat count
|
|
goroutine 1 [running]:
|
strings.Repeat(0xfc95c8, 0x1, 0xfffffffffffffffe, 0xc00030f958, 0x2)
|
/usr/lib/go/src/strings/strings.go:529 +0x5e5
|
github.com/couchbase/cbflag.(*Flag).usageString(0xc0003d9200, 0xc0003f6400, 0x3f9)
|
/home/james/.local/lib/golang/pkg/mod/github.com/couchbase/cbflag@v0.0.0-20200914082931-961919bbb973/flag.go:210 +0x4ba
|
github.com/couchbase/cbflag.(*Command).Usage(0xc00031e700, 0xc00021f470, 0xc000310820)
|
/home/james/.local/lib/golang/pkg/mod/github.com/couchbase/cbflag@v0.0.0-20200914082931-961919bbb973/command.go:324 +0x365
|
github.com/couchbase/cbflag.(*Command).parseFlags(0xc00031e700, 0xc00021f470, 0xc000032090, 0x5, 0x5)
|
/home/james/.local/lib/golang/pkg/mod/github.com/couchbase/cbflag@v0.0.0-20200914082931-961919bbb973/command.go:208 +0x19d0
|
github.com/couchbase/cbflag.(*Command).parse(0xc00031e700, 0xc00021f470, 0xc000032090, 0x5, 0x5)
|
/home/james/.local/lib/golang/pkg/mod/github.com/couchbase/cbflag@v0.0.0-20200914082931-961919bbb973/command.go:92 +0x151
|
github.com/couchbase/cbflag.(*Command).parseCommands(0xc00031f0a0, 0xc00021f470, 0xc000032080, 0x6, 0x6)
|
/home/james/.local/lib/golang/pkg/mod/github.com/couchbase/cbflag@v0.0.0-20200914082931-961919bbb973/command.go:104 +0x135
|
github.com/couchbase/cbflag.(*Command).parse(0xc00031f0a0, 0xc00021f470, 0xc000032080, 0x6, 0x6)
|
/home/james/.local/lib/golang/pkg/mod/github.com/couchbase/cbflag@v0.0.0-20200914082931-961919bbb973/command.go:90 +0xd1
|
github.com/couchbase/cbflag.(*CLI).Parse(0xc0003d4090, 0xc000032070, 0x7, 0x7)
|
/home/james/.local/lib/golang/pkg/mod/github.com/couchbase/cbflag@v0.0.0-20200914082931-961919bbb973/cli.go:59 +0x193
|
main.main()
|
/home/james/Projects/couchbase-build/backup/cmd/cbbackupmgr/main.go:3124 +0x10145
|
|
Attachments
Issue Links
- is duplicated by
-
MB-42179 The short help command for cbbackupmgr restore results in a panic.
- Closed
For Gerrit Dashboard: MB-42147 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
138513,2 | MB-42147 Avoid negative repeat counter when displaying short help | master | cbflag | Status: MERGED | +2 | +1 |
138528,2 | MB-42147 Update cbflag to pick up negative repeat counter fix | master | backup | Status: MERGED | +2 | +1 |