zsync can't process files with large blocksize, but zsyncmake doesn't check this

Bug #421044 reported by psl
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zsync (Ubuntu)
Triaged
Low
Unassigned

Bug Description

Binary package hint: zsync

Ubuntu 8.04, i386
zsync 0.5

zsyncmake is utility to create files with metadata information for zsync client. It has several parameter, one of them is blocksize, -b.

Blocksize value has to be power of 2; this is checked by zsyncmake; exmaple:

# zsyncmake -b 2000
blocksize must be a power of 2 (512, 1024, 2048, ...)

There is other limit, the largest blocksize possible; limited by zsync client design. This value is not checked and zsyncmake utility can create "zsync" file that cannot be processed by client. For example, blocksize 65536 is power by 2 but too big to be processed by zsync client.

Two issues here:
1) zsync client doesn't exit with error when it get zsync file with blocksize bigger that it can process (by sw design limits). When client get file with big blocksize it finish in some never-ending loop... The value in zsync file has to be checked by zsync client.
2) zsyncmake doesn't check blocksize well and warn user that he creates file that cannot be used by zsync client as blocksize is too big.

I think the same could be written about minimum value of blocksize.

I tested values of blocksize 1024, 2048, 4096, 8096 and 16384, these are working well. blocksize value 32768 is too big.

About blocksize from zsyncmake man page:

-b blocksize
              Specify the blocksize to the underlying rsync algorithm. A
              smaller blocksize may be more efficient for files where there
              are likely to be lots of small, scattered changes between down‐
              loads; a larger blocksize is more efficient for files with fewer
              or less scattered changes. This blocksize must be a power of
              two. If not specified, zsyncmake chooses one which it thinks is
              best for this file (currently either 2048 or 4096 depending on
              file size) - so normally you should not need to override the
              default.

Revision history for this message
psl (slansky) wrote :

I tested small values of blocksize, like 1, 2, 4, 8, 16 and it doesn't make serious problem to zsync client. Technical problem is that when blocksize is 8, the zsync file size is similar to original file, when blocksize is 4, zsync file is double in size compared to original file, etc. It doesn't make sense to create files with blocksize smaller than 16 and this should be checked by zsyncmake utility. When blocksize parameter is 0, default value of blocksize (2048) is used.

I modified one zsync file to have blocksize 100 in the header; this is checked by the zsync client and it give up. I like it...

$ zsync http://server/zsync/missing.iso.100.zsync
#################### 100.0% 0.0 kBps DONE

nonsensical blocksize 100

The same should happen when value greater than 16384 is found in the zsync file header.

Revision history for this message
psl (slansky) wrote :

Simple script to create some test zsync files with different blocksize:

for BS in 32768 16384 8196 4096 2048 1024 512 256 128 64 32 16 8 4 2 1; do
  echo "Blocksize: $BS"
  zsyncmake -b $BS testfile.bin -o testfile.bin.$BS.zsync
  ls -l testfile.bin.$BS.zsync
done

Matt Zimmerman (mdz)
summary: - zsyncmake doesn't check blocksize parameter well
+ zsync can't process files with large blocksize, but zsyncmake doesn't
+ check this
Changed in zsync (Ubuntu):
importance: Undecided → Low
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.