From c9c227f2ca794269cdf14d21f075c637e5485051 Mon Sep 17 00:00:00 2001 From: Marian Beermann Date: Sun, 11 Jun 2017 12:37:20 +0200 Subject: [PATCH] cache sync: check Operation.READ compatibility with manifest --- src/borg/cache.py | 5 +++++ src/borg/testsuite/archiver.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/borg/cache.py b/src/borg/cache.py index 0dba8ecc9..70d6f029b 100644 --- a/src/borg/cache.py +++ b/src/borg/cache.py @@ -721,6 +721,11 @@ def legacy_cleanup(): except: pass + # The cache can be used by a command that e.g. only checks against Manifest.Operation.WRITE, + # which does not have to include all flags from Manifest.Operation.READ. + # Since the sync will attempt to read archives, check compatibility with Manifest.Operation.READ. + self.manifest.check_repository_compatibility((Manifest.Operation.READ, )) + self.begin_txn() with cache_if_remote(self.repository, decrypted_cache=self.key) as decrypted_repository: legacy_cleanup() diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py index 6d0b28c4f..e9bcef5e6 100644 --- a/src/borg/testsuite/archiver.py +++ b/src/borg/testsuite/archiver.py @@ -1440,6 +1440,12 @@ def test_unknown_feature_on_create(self): self.add_unknown_feature(Manifest.Operation.WRITE) self.cmd_raises_unknown_feature(['create', self.repository_location + '::test', 'input']) + def test_unknown_feature_on_cache_sync(self): + self.cmd('init', '--encryption=repokey', self.repository_location) + self.cmd('delete', '--cache-only', self.repository_location) + self.add_unknown_feature(Manifest.Operation.READ) + self.cmd_raises_unknown_feature(['create', self.repository_location + '::test', 'input']) + def test_unknown_feature_on_change_passphrase(self): print(self.cmd('init', '--encryption=repokey', self.repository_location)) self.add_unknown_feature(Manifest.Operation.CHECK)