Closed Surendrajat closed 4 years ago
This looks similar to #3 and #13.
I can confirm having the same issue, I'm running Ubuntu 18.04.5 & ZSH (Oh-my-zsh)
`me@laptop ~/projects/project branch-name bit panic: runtime error: slice bounds out of range [:5] with length 4
goroutine 1 [running]: github.com/posener/complete/v2.Complete(0x65e967, 0x3, 0x6d3c20, 0xc0001f5100) /go/pkg/mod/github.com/posener/complete/v2@v2.0.1-alpha.12/complete.go:83 +0x514 github.com/posener/complete/v2.(*Command).Complete(...) /go/pkg/mod/github.com/posener/complete/v2@v2.0.1-alpha.12/command.go:20 main.main() /go/pkg/mod/github.com/chriswalz/bit@v0.5.8/bitcomplete/complete.go:57 +0x75b panic: runtime error: slice bounds out of range [:5] with length 4
goroutine 1 [running]: github.com/posener/complete/v2.Complete(0x65e967, 0x3, 0x6d3c20, 0xc000255100) /go/pkg/mod/github.com/posener/complete/v2@v2.0.1-alpha.12/complete.go:83 +0x514 github.com/posener/complete/v2.(*Command).Complete(...) /go/pkg/mod/github.com/posener/complete/v2@v2.0.1-alpha.12/command.go:20 main.main() /go/pkg/mod/github.com/chriswalz/bit@v0.5.8/bitcomplete/complete.go:57 +0x75b panic: runtime error: slice bounds out of range [:5] with length 4
goroutine 1 [running]: github.com/posener/complete/v2.Complete(0x65e967, 0x3, 0x6d3c20, 0xc0001f15a0) /go/pkg/mod/github.com/posener/complete/v2@v2.0.1-alpha.12/complete.go:83 +0x514 github.com/posener/complete/v2.(*Command).Complete(...) /go/pkg/mod/github.com/posener/complete/v2@v2.0.1-alpha.12/command.go:20 main.main() /go/pkg/mod/github.com/chriswalz/bit@v0.5.8/bitcomplete/complete.go:57 +0x75b `
@ryanpcmcquen it's the same issue reported in #3 (first comment). However, it's still not working even though #3 is closed.
@sarathsp06 @notAmine thanks for filing the issue however I'm having trouble replicating this. Can you update to the most recent version (simply rerun install commands). Then run bit --version
make sure you run it inside a repo.
I installed the tool today: bit version v0.5.6 git version 2.17.1
I was able to reproduce this on the latest version (v0.5.10) as well
` ✘ ~/projects/code-detection master ● bit --version bit version v0.5.10 git version 2.17.1
~/projects/code-detection master ● bit panic: runtime error: slice bounds out of range [:5] with length 4
goroutine 1 [running]: github.com/posener/complete/v2.Complete(0x65e967, 0x3, 0x6d3c00, 0xc000223540) /go/pkg/mod/github.com/posener/complete/v2@v2.0.1-alpha.12/complete.go:83 +0x514 github.com/posener/complete/v2.(*Command).Complete(...) /go/pkg/mod/github.com/posener/complete/v2@v2.0.1-alpha.12/command.go:20 main.main() /go/pkg/mod/github.com/chriswalz/bit@v0.5.11/bitcomplete/complete.go:57 +0x75b panic: runtime error: slice bounds out of range [:5] with length 4
goroutine 1 [running]: github.com/posener/complete/v2.Complete(0x65e967, 0x3, 0x6d3c00, 0xc0001635a0) /go/pkg/mod/github.com/posener/complete/v2@v2.0.1-alpha.12/complete.go:83 +0x514 github.com/posener/complete/v2.(*Command).Complete(...) /go/pkg/mod/github.com/posener/complete/v2@v2.0.1-alpha.12/command.go:20 main.main() /go/pkg/mod/github.com/chriswalz/bit@v0.5.11/bitcomplete/complete.go:57 +0x75b panic: runtime error: slice bounds out of range [:5] with length 4
goroutine 1 [running]: github.com/posener/complete/v2.Complete(0x65e967, 0x3, 0x6d3c00, 0xc0001e5100) /go/pkg/mod/github.com/posener/complete/v2@v2.0.1-alpha.12/complete.go:83 +0x514 github.com/posener/complete/v2.(*Command).Complete(...) /go/pkg/mod/github.com/posener/complete/v2@v2.0.1-alpha.12/command.go:20 main.main() /go/pkg/mod/github.com/chriswalz/bit@v0.5.11/bitcomplete/complete.go:57 +0x75b `
@chriswalz, it'd be neat if there was a failure, if bit
would log the git
command that was being run. That ways users could try that and get better debug info on these kind of errors.
the issue is with a bug in the completion library used and it must be from here: https://github.com/posener/complete/pull/73
@chriswalz You can reproduce this by passing a ${COMP_POINT} env variable higher than the length of ${COMP_LINE}. You can see the same reproduced in the screenshot
The issue is from the completion library as noted above. These are what I can propose
@sarathsp06 Thanks this helps. I'll fork the repo and play around with it. Do you mind going into a little bit more detail on the last bullet?
So as of now I'm thinking I'll submit a PR that would force the COMP_POINT (index of the cursor on the) to be at most the size of the COMP_LINE (the currently typed in command) .
This had me thnking how is it possible that the COMP_POINT is higher than the length of the COMP_LINE. Wouldn't this point to some sort of flaw in the Terminal/Shell
Here's a PR. Can someone test it out https://github.com/chriswalz/bit/pull/44
@chriswalz last bullet is #44 Tested and added review comments, overall looks good to me :+1:
This commit 95323ac424aba276438463caa2922f2399ca0e24 should make the code handle this issue more gracefully in v0.6.0
Installed using curl, cd project, bit [tab] & crash
OS: ubuntu 18.04 SHELL: zsh 5.4.2 Terminal: tilix/guake-terminal/io.elementary.terminal