From c4599d8ea461f9a5cd4fcb2ce50a45eb5d481852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Thu, 15 Oct 2015 18:39:34 -0400 Subject: [PATCH] fix cascading failure with the index conversion code this resolves bug #something where the index file could not be converted, completely breaking conversion. it seems that, during some refactoring, the index conversion code was completely dropped. this was missed by the unit tests because the repo can still be opened by the constructor even though the index is invalid, so tests need improvements there. --- borg/upgrader.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/borg/upgrader.py b/borg/upgrader.py index 33f100e38..daf090998 100644 --- a/borg/upgrader.py +++ b/borg/upgrader.py @@ -139,12 +139,14 @@ class AtticRepositoryUpgrader(Repository): `Cache.open()`, edit in place and then `Cache.close()` to make sure we have locking right """ - caches = [] transaction_id = self.get_index_transaction_id() if transaction_id is None: logger.warning('no index file found for repository %s' % self.path) else: - caches += [os.path.join(self.path, 'index.%d' % transaction_id).encode('utf-8')] + cache = os.path.join(self.path, 'index.%d' % transaction_id).encode('utf-8') + logger.info("converting index cache %s" % cache) + if not dryrun: + AtticRepositoryUpgrader.header_replace(cache, b'ATTICIDX', b'BORG_IDX') # copy of attic's get_cache_dir() attic_cache_dir = os.environ.get('ATTIC_CACHE_DIR',