]> arthur.barton.de Git - bup.git/commit
Always return a level 0 blob from _splitbuf() for BLOB_MAX sized blobs.
authorAidan Hobson Sayers <aidanhs@cantab.net>
Sat, 23 Nov 2013 17:23:04 +0000 (17:23 +0000)
committerRob Browning <rlb@defaultvalue.org>
Sat, 15 Feb 2014 18:45:09 +0000 (12:45 -0600)
commite3297ae411842ca61ed0f94afc97b302e50bdf85
tree627ef2629641c32f0c999fff1a9a40f49bb7e702
parentbca22f5219592dcad4715c7610f7278a9021b6fb
Always return a level 0 blob from _splitbuf() for BLOB_MAX sized blobs.

Previously if _splitbuf() returned an offset anywhere in the buffer we
would always use the 'level' of the offset for the resulting blob.  So
when the offset was greater than BLOB_MAX, we'd still use the offset's
level, even though we'd be returning a blob that didn't reach that
offset.  In some cases, this could cause bup to generate a sequence of
BLOB_MAX sized blobs, each in their own own chunk group.

To fix that, set the level of all BLOB_MAX sized blobs to 0, which
makes those blobs behave just as they would have before this patch,
whenever they were found at the end of the buffer.

Test the new behavior -- the last two of these four new tests will
fail if run before the changes, as they check that blobs split by
enforcing BLOB_MAX do not 'inherit' the value of level from a split
later in the buffer.

Signed-off-by: Aidan Hobson Sayers <aidanhs@cantab.net>
[rlb@defaultvalue.org: squash tests commit into _splitbuf() changes commit;
 adjust commit message.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/hashsplit.py
lib/bup/t/thashsplit.py