dolthub / dolt

Dolt – Git for Data
Apache License 2.0
17.88k stars 507 forks source link

`dolt sql-client` panics if passed a branch scoped database #4623

Closed timsehn closed 1 year ago

timsehn commented 2 years ago
$ dolt sql-client --use-db "test_branch_control/foo" -u root -q "show tables"
invalid DSN: did you forget to escape a param value?
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x272c434]

goroutine 1 [running]:
github.com/dolthub/dolt/go/cmd/dolt/commands/sqlserver.(*ServerController).StopServer(0x30111a0?)
    /Users/timsehn/dolthub/git/dolt/go/cmd/dolt/commands/sqlserver/servercontroller.go:69 +0x14
github.com/dolthub/dolt/go/cmd/dolt/commands/sqlserver.SqlClientCmd.Exec({{0x2c38545?, 0xc000596240?}}, {0x3028518?, 0xc00057a600}, {0xc000058780, 0xf}, {0xc000134020, 0x6, 0x6}, 0xc000af2510)
    /Users/timsehn/dolthub/git/dolt/go/cmd/dolt/commands/sqlserver/sqlclient.go:208 +0x1105
github.com/dolthub/dolt/go/cmd/dolt/cli.SubCommandHandler.handleCommand({{0x2c36043, 0x4}, {0x2c526de, 0x11}, {0x0, 0x0}, {0xc0005e4000, 0x2f, 0x2f}, 0x0}, ...)
    /Users/timsehn/dolthub/git/dolt/go/cmd/dolt/cli/command.go:237 +0x502
github.com/dolthub/dolt/go/cmd/dolt/cli.SubCommandHandler.Exec({{0x2c36043, 0x4}, {0x2c526de, 0x11}, {0x0, 0x0}, {0xc0005e4000, 0x2f, 0x2f}, 0x0}, ...)
    /Users/timsehn/dolthub/git/dolt/go/cmd/dolt/cli/command.go:186 +0x47e
main.runMain()
    /Users/timsehn/dolthub/git/dolt/go/cmd/dolt/dolt.go:395 +0x7a5
main.main()
    /Users/timsehn/dolthub/git/dolt/go/cmd/dolt/dolt.go:140 +0x19
timsehn commented 2 years ago

From the server shell:

$ dolt  branch
  foo                                               
* main                                              
$ dolt sql-server
Starting server with Config HP="localhost:3306"|T="28800000"|R="false"|L="info"|S="/tmp/mysql.sock"
^C%                                                                             $ pwd
/Users/timsehn/dolthub/dolt/test_branch_control