Skip to content

Syncing images of different sizes with a non-divisible block size fails #4

@PhrozenByte

Description

@PhrozenByte

Trying to sync images of different sizes with a non-divisible block size (e.g. syncing a source image of 10 MiB to a target image of 12 MiB with a block size of 4 MiB) fails with the following error:

RuntimeError: Can't sync images of different sizes with a non-divisible block size

This is expected behaviour for now. You must either switch to a divisible block size (e.g. 2 MiB), or ensure that both images match in size, or sync to a non-existing (or zero-length) target image.

The reason is that the last blocks of the images don't match in size (e.g. 2 MiB for the source image, but 4 MiB for the target image). This will not only cause the last block to be always considered different, but will also confuse communications. Right now we don't really use a network protocol, but rather dump raw data. This works because all components are synced and know how many bytes they must read or write. However, due to the size mismatch the sender will send just 2 MiB for the last block, but the receiver will expect 4 MiB - what will cause the program to hang indefinitely.

The only solution is to implement a proper network protocol with package sizes. Also see #3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions