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

Autocompletion makes the shell panic when there's no suggestion #178

Closed
asdine opened this issue Sep 6, 2020 · 0 comments · Fixed by #251
Closed

Autocompletion makes the shell panic when there's no suggestion #178

asdine opened this issue Sep 6, 2020 · 0 comments · Fixed by #251
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest https://hacktoberfest.digitalocean.com/
Milestone

Comments

@asdine
Copy link
Collaborator

asdine commented Sep 6, 2020

genji> EXPLAIN SELECT a, b FROM foo WHERE a != panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/genjidb/genji/cmd/genji/shell.(*Shell).completer(0xc00013a3c0, 0xc000030320, 0x45, 0x29, 0x994940, 0xc00013a401, 0xc0002ed580)
        /home/asdine/code/github.com/genjidb/genji/cmd/genji/shell/shell.go:380 +0x5e6
github.com/c-bata/go-prompt.(*CompletionManager).Update(...)
        /home/asdine/go/pkg/mod/github.com/c-bata/go-prompt@v0.2.3/completion.go:69
github.com/c-bata/go-prompt.(*Prompt).Run(0xc000142400)
        /home/asdine/go/pkg/mod/github.com/c-bata/go-prompt@v0.2.3/prompt.go:95 +0x6cd
github.com/genjidb/genji/cmd/genji/shell.Run(0xc000129620, 0xc000129620, 0xc000138840)
        /home/asdine/code/github.com/genjidb/genji/cmd/genji/shell/shell.go:114 +0x365
main.main.func1(0xc000162840, 0x0, 0xc00014a6e0)
        /home/asdine/code/github.com/genjidb/genji/cmd/genji/main.go:52 +0x165
github.com/urfave/cli.HandleAction(0x95e0a0, 0xa22000, 0xc000162840, 0xc000162840, 0x0)
        /home/asdine/go/pkg/mod/github.com/urfave/cli@v1.22.4/app.go:526 +0xfd
github.com/urfave/cli.(*App).Run(0xc000252000, 0xc0001181b0, 0x1, 0x1, 0x0, 0x0)
        /home/asdine/go/pkg/mod/github.com/urfave/cli@v1.22.4/app.go:288 +0x655
main.main()
        /home/asdine/code/github.com/genjidb/genji/cmd/genji/main.go:58 +0x1d4

This happens when the parser returns a parseError with no suggestion in it. A check must be added before using parser suggestions.

@asdine asdine added this to the v0.8.0 milestone Sep 6, 2020
@asdine asdine added bug Something isn't working good first issue Good for newcomers labels Sep 6, 2020
@asdine asdine modified the milestones: v0.8.0, v0.9.0 Sep 26, 2020
@asdine asdine added the hacktoberfest https://hacktoberfest.digitalocean.com/ label Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest https://hacktoberfest.digitalocean.com/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant