jb2170 / better-adb-sync

Completely rewritten adbsync with --exclude
Apache License 2.0
369 stars 25 forks source link

Doesn't resync "half-pulled" (or "half-pushed") files #23

Open TomasRiker opened 1 year ago

TomasRiker commented 1 year ago

I just aborted a sync, so one big file ended up being pulled only half. The next sync, that file didn't get synced again. better-adb-sync should check if files have the correct size, and if not, resync.

jb2170 commented 1 year ago

I'd guess the half-copied file being left behind is more an issue with adb than adbsync since adb push ${filename} is used to copy the file. Perhaps a --checksum, -c option could be implemented, that rsync has?

TomasRiker commented 1 year ago

I wouldn't say it's an issue with adb. When adb is terminated during a transfer (because the user kills better-adb-sync), there's not much it can do about it. Well, maybe it could write the file to a temporary location and move it to the final destination after the transfer is complete. But adb behaves as it does, and if better-adb-sync depends on adb, then it should be able to cope with its peculiarities, in my opinion.

Using checksums would be nice, since it could also detect files that have the same size but differ in content. For the beginning, checking only the size would be fine, too :-)

Joshfindit commented 1 year ago

Since adb is all or nothing, I think a solid approach would be to catch the cancellation and ask whether the user wants to delete the partial file (99% of use-cases) or keep it (if doing data recovery for example).

Vadworks commented 7 months ago

It might be possible to compare file sizes. This would be faster than checksum, which would require reading all the files (potentially gigs of data) Seems adbsync is already pulling file lists, so just an extra step to compare sizes?

I'm glad I double checked this behavior, since my laptop kept falling asleep during sync, now I have a bunch of half copied pictures/videos.

kokroo commented 2 weeks ago

"sync" in the name really doesn't do justice if it doesn't actually verify if the files were copied over properly.