From c68cad97273c9078a281c7bac56b31ee222eaa7a Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Tue, 25 Jun 2019 23:15:13 +0200 Subject: [PATCH] SecurityManager.known(): check all files, fixes #4614 Before this fix, because known() only checked the key-type file, the location file could go missing without being automatically regenerated. Now a save() is triggered if not all files are present. --- src/borg/cache.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/borg/cache.py b/src/borg/cache.py index ba92e335f..ea3c800ad 100644 --- a/src/borg/cache.py +++ b/src/borg/cache.py @@ -73,7 +73,8 @@ class SecurityManager: shutil.rmtree(path) def known(self): - return os.path.exists(self.key_type_file) + return all(os.path.exists(f) + for f in (self.key_type_file, self.location_file, self.manifest_ts_file)) def key_matches(self, key): if not self.known():