From 1b992fb662acb7e68e9a25526c73178446b2d291 Mon Sep 17 00:00:00 2001 From: bescoto Date: Wed, 17 Aug 2005 05:55:18 +0000 Subject: Further fix so we can restore backups with mirror_metadata files missing intermediate directory git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@620 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/CHANGELOG | 10 ++++++++++ rdiff-backup/rdiff_backup/rorpiter.py | 6 ++++++ rdiff-backup/rdiff_backup/rpath.py | 5 +++++ 3 files changed, 21 insertions(+) diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG index d275d38..4684f54 100644 --- a/rdiff-backup/CHANGELOG +++ b/rdiff-backup/CHANGELOG @@ -1,3 +1,13 @@ +New in v1.0.1 (????/??/??) +-------------------------- + +Fix for "'filetype' of type exceptions.KeyError" error when restoring. +Test case provided by Davy Durham. (The problem was the +mirror_metadata file could become un-synced when a file is deleted +when rdiff-backup is running and later the directory that file is in +gets deleted.) + + New in v1.0.0 (2005/08/14) -------------------------- diff --git a/rdiff-backup/rdiff_backup/rorpiter.py b/rdiff-backup/rdiff_backup/rorpiter.py index 9bf75d4..88d5bcd 100644 --- a/rdiff-backup/rdiff_backup/rorpiter.py +++ b/rdiff-backup/rdiff_backup/rorpiter.py @@ -184,6 +184,12 @@ def FillInIter(rpiter, rootrp): for i in range(1, len(cur_index)): # i==0 case already handled if cur_index[:i] != old_index[:i]: filler_rp = rootrp.new_index(cur_index[:i]) + if not filler_rp.isdir(): + log.Log("Warning: expected %s to be a directory but " + "found %s instead.\nThis is probably caused " + "by a bug in versions 1.0.0 and earlier." % + (filler_rp.path, filler_rp.lstat()), 2) + filler_rp.make_zero_dir(rootrp) yield filler_rp yield rp old_index = cur_index diff --git a/rdiff-backup/rdiff_backup/rpath.py b/rdiff-backup/rdiff_backup/rpath.py index 42ad5e9..05249ec 100644 --- a/rdiff-backup/rdiff_backup/rpath.py +++ b/rdiff-backup/rdiff_backup/rpath.py @@ -283,6 +283,11 @@ class RORPath: self.data = {'type': None} self.file = None + def make_zero_dir(self, dir_rp): + """Set self.data the same as dir_rp.data but with safe permissions""" + self.data = dir_rp.data.copy() + self.data['perms'] = 0700 + def __nonzero__(self): return 1 def __eq__(self, other): -- cgit v1.2.1