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

sftp URL parsing bug #587

Closed
wscott opened this issue Aug 26, 2016 · 1 comment
Closed

sftp URL parsing bug #587

wscott opened this issue Aug 26, 2016 · 1 comment
Assignees

Comments

@wscott
Copy link

wscott commented Aug 26, 2016

Output of restic version

$ restic version
restic 0.2.0 (v0.2.0-150-g9fd941f)
compiled at 2016-08-26 07:59:14 with go1.6

Problem

Trying to backup to my NAS

  • synology
  • I have ssh access with no password

This looks like a command line parsing error.

$ restic -r sftp://p4:backups.restic init
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
panic(0x9c2a60, 0xc82000e160)
    /usr/local/go/src/runtime/panic.go:464 +0x3e6
restic/backend/sftp.ParseConfig(0x7ffda12c547f, 0x18, 0x0, 0x0, 0x0, 0x0)
    /tmp/restic-build-041587322/src/restic/backend/sftp/config.go:34 +0x317
restic/location.Parse(0x7ffda12c547f, 0x18, 0x7ffda12c547f, 0x4, 0x0, 0x0, 0x0, 0x0)
    /tmp/restic-build-041587322/src/restic/location/location.go:47 +0x1d2
main.create(0x7ffda12c547f, 0x18, 0x0, 0x0, 0x0, 0x0)
    /tmp/restic-build-041587322/src/cmds/restic/global.go:280 +0x18f
main.CmdInit.Execute(0xd65880, 0xc8201486c0, 0x0, 0x3, 0x0, 0x0)
    /tmp/restic-build-041587322/src/cmds/restic/cmd_init.go:18 +0x169
main.(*CmdInit).Execute(0xc82002a080, 0xc8201486c0, 0x0, 0x3, 0x0, 0x0)
    <autogenerated>:29 +0xb9
github.com/jessevdk/go-flags.(*Parser).ParseArgs(0xc820014910, 0xc82000a3d0, 0x3, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0)
    /tmp/restic-build-041587322/src/github.com/jessevdk/go-flags/parser.go:278 +0x8dd
github.com/jessevdk/go-flags.(*Parser).Parse(0xc820014910, 0x0, 0x0, 0x0, 0x0, 0x0)
    /tmp/restic-build-041587322/src/github.com/jessevdk/go-flags/parser.go:154 +0x9b
main.main()
    /tmp/restic-build-041587322/src/cmds/restic/main.go:32 +0x1e8

Tried changing the URL and this doesn't look right either:

$ restic -r sftp://p4/backups.restic init
subsystem request failed on channel 0
2016/08/26 08:07:48 EOF

Looked up the example in the docs and tried again:

$ restic -r sftp:p4:backups.restic init
subsystem request failed on channel 0
2016/08/26 08:09:42 EOF

So after fixing the parsing issue it still doesn't seem happy and the error message could use some help. I am not familiar with SFTP, is that something that needs to be explicitly enabled in the ssh server?

@wscott
Copy link
Author

wscott commented Aug 26, 2016

So I figured out some of my problems getting this to work. SFTP isn't enabled by default, so the second example output above is a bad error message.

So now I have it enabled, and it took some more testing to discover than the SFTP server is running in a chroot so the pathnames are different. Now here is what I believe is the correct URL and I verified that 'sftp' works.

$ restic -r sftp:wscott@p4:/homes/wscott/backups.restic key list
enter password for repository: 
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x28 pc=0x745bde]

goroutine 1 [running]:
panic(0x9c2c80, 0xc82000e1a0)
    /nix/store/s14qz1i878wixyif1l74wk0a6pfyj177-go-1.6.3/share/go/src/runtime/panic.go:481 +0x3e6
github.com/pkg/sftp.(*File).Write(0x0, 0xc82016c210, 0xa7, 0xa7, 0xc8221e1488, 0x0, 0x0)
    /tmp/restic-build-214816402/src/github.com/pkg/sftp/client.go:971 +0x4e
restic/backend/sftp.(*SFTP).Save(0xc8201641a0, 0xa7bc60, 0x4, 0xc820072100, 0x40, 0xc82016c210, 0xa7, 0xa7, 0x7f1beb4f90a0, 0xc82000aa50)
    /tmp/restic-build-214816402/src/restic/backend/sftp/sftp.go:334 +0x393
restic/repository.(*Repository).SaveUnpacked(0xc82016e0c0, 0xa7bc60, 0x4, 0xc82009e000, 0x87, 0x103, 0x5b1ee3cbb2eab5b1, 0x2807ce0c0484f07c, 0x92608f1c30233da7, 0xf14bc41655bf7192, ...)
    /tmp/restic-build-214816402/src/restic/repository/repository.go:271 +0x245
restic/repository.(*Repository).SaveJSONUnpacked(0xc82016e0c0, 0xa7bc60, 0x4, 0xa35700, 0xc82016e3c0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /tmp/restic-build-214816402/src/restic/repository/repository.go:256 +0x33a
restic.(*Lock).createLock(0xc82016e3c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /tmp/restic-build-214816402/src/restic/lock.go:168 +0x8e
restic.newLock(0xc82016e0c0, 0xc820032000, 0x7f1beb5bd568, 0x0, 0x0)
    /tmp/restic-build-214816402/src/restic/lock.go:94 +0x202
restic.NewLock(0xc82016e0c0, 0x9, 0x0, 0x0)
    /tmp/restic-build-214816402/src/restic/lock.go:61 +0x32
main.lockRepository(0xc82016e0c0, 0x8d0c00, 0x0, 0x0, 0x0)
    /tmp/restic-build-214816402/src/cmds/restic/lock.go:35 +0x4f
main.lockRepo(0xc82016e0c0, 0x4, 0x0, 0x0)
    /tmp/restic-build-214816402/src/cmds/restic/lock.go:22 +0x32
main.CmdKey.Execute(0xd6a8a0, 0x0, 0x0, 0xc820012d80, 0x1, 0x4, 0x0, 0x0)
    /tmp/restic-build-214816402/src/cmds/restic/cmd_key.go:126 +0x773
main.(*CmdKey).Execute(0xc8200ed480, 0xc820012d80, 0x1, 0x4, 0x0, 0x0)
    <autogenerated>:36 +0xcb
github.com/jessevdk/go-flags.(*Parser).ParseArgs(0xc82000a9b0, 0xc82000a100, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0)
    /tmp/restic-build-214816402/src/github.com/jessevdk/go-flags/parser.go:278 +0x8dd
github.com/jessevdk/go-flags.(*Parser).Parse(0xc82000a9b0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /tmp/restic-build-214816402/src/github.com/jessevdk/go-flags/parser.go:154 +0x9b
main.main()
    /tmp/restic-build-214816402/src/cmds/restic/main.go:32 +0x1e8

It does prompt be for the repo password and it only works if that password is valid so at least some of this is working. But any attempt to do anything fails. I settled on this 'key list' command for the example.

BTW I have another backup via NFS running at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants