duplicacy icon indicating copy to clipboard operation
duplicacy copied to clipboard

Backup crashes with index out of range if all files are of size 0

Open ustulation opened this issue 2 years ago • 3 comments

If I'm backing up some directory where i ran duplicacy init -storage-name blah blah-id /path/to/storage-url using duplicacy backup -storage blah, then the latter command crashes if all the files in the dir (and its sub-dirs) are of 0 size. Eg. if you just do touch hello and run the backup command and if hello happens to be the only file in the dir to be backed up, the command will crash with:

Loaded 0 include/exclude pattern(s)
runtime error: index out of range [0] with length 0
goroutine 1 [running]:
runtime/debug.Stack()
        /usr/lib/go/src/runtime/debug/stack.go:24 +0x65
runtime/debug.PrintStack()
        /usr/lib/go/src/runtime/debug/stack.go:16 +0x19
github.com/gilbertchen/duplicacy/src.CatchLogException()
        /root/my/go/src/github.com/gilbertchen/duplicacy/src/duplicacy_log.go:233 +0xad
panic({0x1131700, 0xc000036120})
        /usr/lib/go/src/runtime/panic.go:838 +0x207
github.com/gilbertchen/duplicacy/src.(*BackupManager).UploadSnapshot.func3(0xc000180000)
        /root/my/go/src/github.com/gilbertchen/duplicacy/src/duplicacy_backupmanager.go:1052 +0x630
github.com/gilbertchen/duplicacy/src.(*EntryList).fillAndSendEntry(0x1012115138e55?, 0xc000180000, 0xc00061c3d8)
        /root/my/go/src/github.com/gilbertchen/duplicacy/src/duplicacy_entrylist.go:269 +0x262
github.com/gilbertchen/duplicacy/src.(*EntryList).ReadEntries(0xc000291d40, 0x100000?)
        /root/my/go/src/github.com/gilbertchen/duplicacy/src/duplicacy_entrylist.go:329 +0x306
github.com/gilbertchen/duplicacy/src.(*BackupManager).UploadSnapshot(0xc00018b9d0, 0xc000274320, {0x0?, 0xc00061c950?}, 0xc0001b2460, 0xc00031c708?, 0xc00061c8b0, 0x0?)
        /root/my/go/src/github.com/gilbertchen/duplicacy/src/duplicacy_backupmanager.go:1084 +0x4a5
github.com/gilbertchen/duplicacy/src.(*BackupManager).Backup(0xc00018b9d0, {0xc000038004?, 0xc0000366a8?}, 0x1, 0x0?, {0x0, 0x0}, 0x0, 0x0, 0x0, ...)
        /root/my/go/src/github.com/gilbertchen/duplicacy/src/duplicacy_backupmanager.go:522 +0x1ec8
main.backupRepository(0xc000291c20)
        /root/my/go/src/github.com/gilbertchen/duplicacy/duplicacy/duplicacy_main.go:791 +0x6d0
github.com/gilbertchen/cli.Command.Run({{0x11bc9c0, 0x6}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x11fd4dd, 0x30}, {0x0, ...}, ...}, ...)
        /root/my/go/src/github.com/gilbertchen/cli/command.go:160 +0x95a
github.com/gilbertchen/cli.(*App).Run(0xc0002919e0, {0xc0000321e0, 0x6, 0x6})
        /root/my/go/src/github.com/gilbertchen/cli/app.go:179 +0xda5
main.main()
        /root/my/go/src/github.com/gilbertchen/duplicacy/duplicacy/duplicacy_main.go:2231 +0x6905

Adding a single non-0 sized file anywhere in the dir will prevent the error and backup works as it should. Probably some bug that needs fixed?

Running on ArchLinux Docker with image from today (Jul 4th 2022). The duplicacy source code from master branch was used to build duplicacy. This is the current commit at master: https://github.com/gilbertchen/duplicacy/commit/fc2386f9ccd7cf7af7829c29f0a409e4b7527566

ustulation avatar Jul 04 '22 14:07 ustulation

(I wanted to post it to the forum but unfortunately i don't have my password anymore and the login page there didn't give me the option to reset password. I'll try to look more thoroughly for it later, but couldn't find the forgot password or equivalent straight away.)

ustulation avatar Jul 04 '22 14:07 ustulation

I have exactly same issue, cannot even init repository to backup "/" of my server :(

ondrejkopka avatar Jul 30 '22 12:07 ondrejkopka

I also have this issue backing up a repository containing a single blank file on Windows 10 Duplicacy CLI 3.0.1 (72EB33).

rwells1703 avatar Jan 02 '23 00:01 rwells1703