Problem
When generating a .zsync file for a large source file that is not an exact multiple of the block size, the .zsync "Length" is truncated and the last partial block is omitted. As a result, zsync2 clients download an incomplete file.
Steps to Reproduce
- Create a large file whose size is not a multiple of the block size (e.g., 3.9 GB, block size 524288).
- Run zsyncmake2 to create the .zsync file.
- Download using zsync2. Resulting file is truncated.
Example of file sizes differing where the source test-release.tgz zsync file was created with blocksize of 524288, zsync2 was used to download the file and output as appliance-release.tgz. cmp was used to verify that only the last partial block was missing from the downloaded file.
# ls -l appliance-release.tgz test-release.tgz
-rw------- 1 root root 3934257152 Aug 6 23:01 appliance-release.tgz
-rw-r--r-- 1 root root 3934466485 Aug 6 23:01 test-release.tgz
Workaround
Padding the file to a block-aligned size avoids the issue.
Fix
I have created a PR to address this issue.
(see PR #84 )