trntv / sshed

sshed - ssh config editor and bookmarks manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error when no new line at end of .ssh/config

fredericrous opened this issue · comments

Hey! First of all thank you for this tool. There are lots of bookmark managers for ssh, but it's the first one I find that does exactly what I want, be simple and :

  • command line
  • cross platform (we're almost there)
  • does not need extra framework like ruby or node
  • comply with ssh config standard

I noticed an issue. If I edit the config file myself and forget to add extra new line at the end of the file (yeah I should use a better text editor),
Then I got this error (on macos):

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x10f9fe4]

goroutine 1 [running]:
github.com/trntv/sshed/vendor/github.com/kevinburke/ssh_config.decode.func1(0xc4200439d8)
	/private/tmp/sshed-20180227-76310-ks2fwc/src/github.com/trntv/sshed/vendor/github.com/kevinburke/ssh_config/config.go:216 +0x1f2
panic(0x11f6680, 0x1362e40)
	/usr/local/Cellar/go/1.10/libexec/src/runtime/panic.go:505 +0x229
github.com/trntv/sshed/vendor/github.com/kevinburke/ssh_config.(*sshParser).parseKV(0xc42005a3c0, 0xc42012a080)
	/private/tmp/sshed-20180227-76310-ks2fwc/src/github.com/trntv/sshed/vendor/github.com/kevinburke/ssh_config/parser.go:99 +0x264
github.com/trntv/sshed/vendor/github.com/kevinburke/ssh_config.(*sshParser).(github.com/trntv/sshed/vendor/github.com/kevinburke/ssh_config.parseKV)-fm(0xc42012a080)
	/private/tmp/sshed-20180227-76310-ks2fwc/src/github.com/trntv/sshed/vendor/github.com/kevinburke/ssh_config/parser.go:80 +0x2a
github.com/trntv/sshed/vendor/github.com/kevinburke/ssh_config.(*sshParser).run(0xc42005a3c0)
	/private/tmp/sshed-20180227-76310-ks2fwc/src/github.com/trntv/sshed/vendor/github.com/kevinburke/ssh_config/parser.go:38 +0x42
github.com/trntv/sshed/vendor/github.com/kevinburke/ssh_config.parseSSH(0xc4200781e0, 0xc420070000, 0xc4200781e0)
	/private/tmp/sshed-20180227-76310-ks2fwc/src/github.com/trntv/sshed/vendor/github.com/kevinburke/ssh_config/parser.go:180 +0x307
github.com/trntv/sshed/vendor/github.com/kevinburke/ssh_config.decode(0x125d680, 0xc42007b380, 0x0, 0x0, 0x0, 0x0)
	/private/tmp/sshed-20180227-76310-ks2fwc/src/github.com/trntv/sshed/vendor/github.com/kevinburke/ssh_config/config.go:226 +0x90
github.com/trntv/sshed/vendor/github.com/kevinburke/ssh_config.Decode(0x125d680, 0xc42007b380, 0xc4200d6000, 0x2c5, 0x4c5)
	/private/tmp/sshed-20180227-76310-ks2fwc/src/github.com/trntv/sshed/vendor/github.com/kevinburke/ssh_config/config.go:209 +0x3c
github.com/trntv/sshed/ssh.Parse(0xc420013080, 0x1a, 0x6, 0xc420013080)
	/private/tmp/sshed-20180227-76310-ks2fwc/src/github.com/trntv/sshed/ssh/config.go:45 +0x13d
main.main.func1(0xc4200bc420, 0xc42000add0, 0xc420043b98)
	/private/tmp/sshed-20180227-76310-ks2fwc/src/github.com/trntv/sshed/cmd/cmd.go:62 +0x78
github.com/trntv/sshed/commands.RegisterCommands.func1(0xc4200bc420, 0xc4200bc400, 0x6)
	/private/tmp/sshed-20180227-76310-ks2fwc/src/github.com/trntv/sshed/commands/commands.go:33 +0x3f
github.com/trntv/sshed/vendor/github.com/urfave/cli.(*App).Run(0xc42007ed00, 0xc42000a080, 0x2, 0x2, 0x0, 0x0)
	/private/tmp/sshed-20180227-76310-ks2fwc/src/github.com/trntv/sshed/vendor/github.com/urfave/cli/app.go:241 +0x6f0
main.main()
	/private/tmp/sshed-20180227-76310-ks2fwc/src/github.com/trntv/sshed/cmd/cmd.go:75 +0x519

environment
sshed version: 1.0.3
platform: macos high sierra

Hi @zougi glad this tool is useful for you. it seems you amongst very first users :-)

About the issue, i'll investigate it today. Thanks for reporting it