moul/assh

Runtime error: slice bounds out of range

n11c opened this issue · 7 comments

n11c commented

Hi,

I'm getting the following trying to use assh wrapper:

__$ assh wrapper ssh server
panic: runtime error: slice bounds out of range [recovered]
    panic: runtime error: slice bounds out of range

goroutine 1 [running]:
panic(0x6e8960, 0xc82000e0e0)
    /usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/moul/advanced-ssh-config/vendor/github.com/codegangsta/cli.HandleAction.func1(0xc8201000c0)
    /home/nbr/.go/src/github.com/moul/advanced-ssh-config/vendor/github.com/codegangsta/cli/app.go:472 +0x417
panic(0x6e8960, 0xc82000e0e0)
    /usr/local/go/src/runtime/panic.go:443 +0x4e9
github.com/moul/advanced-ssh-config/pkg/utils.ExpandUser(0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/nbr/.go/src/github.com/moul/advanced-ssh-config/pkg/utils/env.go:45 +0x290
github.com/moul/advanced-ssh-config/pkg/config.(*Config).LoadFile(0xc8200bb000, 0x0, 0x0, 0x0, 0x0)
    /home/nbr/.go/src/github.com/moul/advanced-ssh-config/pkg/config/config.go:403 +0x6d
github.com/moul/advanced-ssh-config/pkg/config.Open(0x0, 0x0, 0x6, 0x0, 0x0)
    /home/nbr/.go/src/github.com/moul/advanced-ssh-config/pkg/config/config.go:532 +0x175
github.com/moul/advanced-ssh-config/pkg/commands.cmdWrapper(0xc8200b2780, 0x0, 0x0)
    /home/nbr/.go/src/github.com/moul/advanced-ssh-config/pkg/commands/wrapper.go:47 +0x1103
reflect.Value.call(0x6827c0, 0x7cbd88, 0x13, 0x743578, 0x4, 0xc820100020, 0x1, 0x1, 0x0, 0x0, ...)
    /usr/local/go/src/reflect/value.go:435 +0x120d
reflect.Value.Call(0x6827c0, 0x7cbd88, 0x13, 0xc820100020, 0x1, 0x1, 0x0, 0x0, 0x0)
    /usr/local/go/src/reflect/value.go:303 +0xb1
github.com/moul/advanced-ssh-config/vendor/github.com/codegangsta/cli.HandleAction(0x6827c0, 0x7cbd88, 0xc8200b2780, 0x0, 0x0)
    /home/nbr/.go/src/github.com/moul/advanced-ssh-config/vendor/github.com/codegangsta/cli/app.go:481 +0x2ee
github.com/moul/advanced-ssh-config/vendor/github.com/codegangsta/cli.Command.Run(0x746ed0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x74c080, 0x8, 0x0, ...)
    /home/nbr/.go/src/github.com/moul/advanced-ssh-config/vendor/github.com/codegangsta/cli/command.go:186 +0x1301
github.com/moul/advanced-ssh-config/vendor/github.com/codegangsta/cli.(*App).RunAsSubcommand(0xc820068d80, 0xc8200b2500, 0x0, 0x0)
    /home/nbr/.go/src/github.com/moul/advanced-ssh-config/vendor/github.com/codegangsta/cli/app.go:355 +0x10d5
github.com/moul/advanced-ssh-config/vendor/github.com/codegangsta/cli.Command.startApp(0x747410, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7a06e0, 0x2a, 0x0, ...)
    /home/nbr/.go/src/github.com/moul/advanced-ssh-config/vendor/github.com/codegangsta/cli/command.go:273 +0xa30
github.com/moul/advanced-ssh-config/vendor/github.com/codegangsta/cli.Command.Run(0x747410, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7a06e0, 0x2a, 0x0, ...)
    /home/nbr/.go/src/github.com/moul/advanced-ssh-config/vendor/github.com/codegangsta/cli/command.go:74 +0x7b
github.com/moul/advanced-ssh-config/vendor/github.com/codegangsta/cli.(*App).Run(0xc820068c00, 0xc820074100, 0x4, 0x4, 0x0, 0x0)
    /home/nbr/.go/src/github.com/moul/advanced-ssh-config/vendor/github.com/codegangsta/cli/app.go:235 +0xa9c
main.main()
    /home/nbr/.go/src/github.com/moul/advanced-ssh-config/cmd/assh/main.go:48 +0x57f

Any idea ?

Go version: go1.6.3 linux/amd64
ASSH version: 2.4.0 (via go get)

Hello,

The same error occurred.

Go version: go1.6.3 darwin/amd64
ASSH version: 2.4.0 (via brew install)

moul commented

Hey guys, thank you for the report,

Can you both send me the content of your (anonymized) assh.yml file ?
I think this is due to recent changes, I probably forget to add some tests

Hi @moul, thank you for your reply.

Here's the output of my assh.yml:

hosts:
  hoge:
    User: user
    HostName: hoge.example.com

I think ASSH works well in version 2.3.0.

n11c commented

Here is mine

---
hosts:
  git.example.com:
    inherits:
      - git
  github.com:
    inherits:
      - git
  backup:
    Hostname: backup.example.com
    inherits:
      - public
  staff:
    Hostname: staff.example.com
    inherits:
      - public
  "zimbra-git":
    Hostname: git.zimbra.com
    User: public
    IdentityFile: ~/.ssh/zimbra_git
    IdentitiesOnly: yes
    Port: 1067

templates:
  public:
    Port: 2222
  git:
    User: git
    IdentityFile: ~/.ssh/git
    Port: 22

defaults:
  ControlMaster: auto
  ControlPath: ~/tmp/.ssh/cm/%h-%p-%r.sock
  ControlPersist: yes
  Port: 22
  User: user
  IdentityFile: ~/.ssh/id_rsa
  ForwardAgent: yes
  IdentitiesOnly: yes

includes:
  - ~/.ssh/assh.d/*.yml

Note: there's nothing in assh.d/

moul commented

Fixed, I will release a new version now :)

moul commented

Version 2.4.1 released

n11c commented

awesome, all good now.
Thanks !