surma/s3put

panic: runtime error: invalid memory address or nil pointer dereference

alexs77 opened this issue · 2 comments

s3put crashes right away after start.

Ubuntu 14.04 system:

$ ./s3put_linux_amd64 -k $AWS_ACCESS_KEY_ID -s $AWS_ACCESS_KEY_SECRET -b $bucket put date.txt
2017/03/07 09:02:19 Starting 10 goroutines...
2017/03/07 09:02:19 Transfering (Prefix: /home/ask/tmp/static/prod) /home/ask/tmp/static/prod/date.txt...
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x28 pc=0x405a34]

goroutine 15 [running]:
panic(0x7f2960, 0xc8200100a0)
    /Users/surma/.homebrew/Cellar/go/1.6/libexec/src/runtime/panic.go:464 +0x3e6
main.CopyItems.func1(0xc8200113b0, 0xc82005e1e0, 0x0, 0x0, 0x455f00)
    /Users/surma/src/github.com/surma/s3put/storage.go:217 +0x174
created by main.CopyItems
    /Users/surma/src/github.com/surma/s3put/storage.go:229 +0x18a

Ubuntu 16.04 system:

$ ./s3put_linux_386 -k $AWS_ACCESS_KEY_ID -s $AWS_ACCESS_KEY_SECRET -b $bucket put .
2017/03/07 09:00:34 Starting 10 goroutines...
2017/03/07 09:00:34 Traversing /home/i/tmp...
2017/03/07 09:00:34 Transfering (Prefix: /home/i/tmp) /home/i/tmp/index.html...
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x18 pc=0x804cc8c]

goroutine 15 [running]:
panic(0x8369e00, 0x18724030)
    /Users/surma/.homebrew/Cellar/go/1.6/libexec/src/runtime/panic.go:464 +0x326
main.CopyItems.func1(0x1877db20, 0x18714fc0, 0x0, 0x0, 0x8095300)
    /Users/surma/src/github.com/surma/s3put/storage.go:217 +0x12c
created by main.CopyItems
    /Users/surma/src/github.com/surma/s3put/storage.go:229 +0x13d

Both the linux 386 and amd64 versions crash. I downloaded the binaries from your release section @ https://github.com/surma/s3put/releases

surma commented

Sorry for taking so long to address this, I was quite swamped. I’m investigating now.

surma commented

Okay, so it’s not a bug per se, it’s just that I didn‘t handle malformed bucket URLs gracefully.

I fixed it in 3.0.3 (commit 4b8bc5d) and updated the README. I’m uploading new binaries as well.

Please take a look and try again. Closing this for now, but feel free to re-open if the problem persists :)