mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 09:19:31 +00:00
borg check: check file size consistency
This commit is contained in:
parent
50068c596d
commit
adc4da280d
2 changed files with 10 additions and 1 deletions
|
@ -1306,6 +1306,13 @@ def replacement_chunk(size):
|
|||
logger.info('{}: Completely healed previously damaged file!'.format(item.path))
|
||||
del item.chunks_healthy
|
||||
item.chunks = chunk_list
|
||||
if 'size' in item:
|
||||
item_size = item.size
|
||||
item_chunks_size = item.get_size(compressed=False, from_chunks=True)
|
||||
if item_size != item_chunks_size:
|
||||
# just warn, but keep the inconsistency, so that borg extract can warn about it.
|
||||
logger.warning('{}: size inconsistency detected: size {}, chunks size {}'.format(
|
||||
item.path, item_size, item_chunks_size))
|
||||
|
||||
def robust_iterator(archive):
|
||||
"""Iterates through all archive items
|
||||
|
|
|
@ -176,7 +176,7 @@ class Item(PropDict):
|
|||
|
||||
part = PropDict._make_property('part', int)
|
||||
|
||||
def get_size(self, hardlink_masters=None, memorize=False, compressed=False):
|
||||
def get_size(self, hardlink_masters=None, memorize=False, compressed=False, from_chunks=False):
|
||||
"""
|
||||
Determine the (uncompressed or compressed) size of this item.
|
||||
|
||||
|
@ -187,6 +187,8 @@ class Item(PropDict):
|
|||
"""
|
||||
attr = 'csize' if compressed else 'size'
|
||||
try:
|
||||
if from_chunks:
|
||||
raise AttributeError
|
||||
size = getattr(self, attr)
|
||||
except AttributeError:
|
||||
# no precomputed (c)size value available, compute it:
|
||||
|
|
Loading…
Reference in a new issue