summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-06-24 06:36:44 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-06-24 06:36:44 +0000
commit3ed3511433b07b98e782d5bd4a7ba5e930c2a797 (patch)
tree67cd743af4c271a81b63708e2008c6b385bca071
parent0f18c064359d2eaa0ee7bfaacb810c822eade82e (diff)
downloadrdiff-backup-3ed3511433b07b98e782d5bd4a7ba5e930c2a797.tar.gz
Only warn, not AssertionError, if can't get restore fp
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@327 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/rdiff_backup/restore.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/rdiff-backup/rdiff_backup/restore.py b/rdiff-backup/rdiff_backup/restore.py
index 0380450..27c6f72 100644
--- a/rdiff-backup/rdiff_backup/restore.py
+++ b/rdiff-backup/rdiff_backup/restore.py
@@ -20,7 +20,7 @@
"""Read increment files and restore to original"""
from __future__ import generators
-import tempfile, os
+import tempfile, os, cStringIO
import Globals, Time, Rdiff, Hardlink, rorpiter, selection, rpath, \
log, static, robust, metadata, statistics, TempFile
@@ -381,8 +381,16 @@ class RestoreFile:
def get_restore_fp(self):
"""Return file object of restored data"""
- assert self.relevant_incs[-1].isreg(), \
- (mirror_rp.index, self.relevant_incs[-1].lstat())
+ if not self.relevant_incs[-1].isreg():
+ log.Log("""Warning: Could not restore file %s!
+
+A regular file was indicated by the metadata, but could not be
+constructed from existing increments because last increment had type
+%s. Instead of the actual file's data, an empty length file will be
+created. This error is probably caused by data loss in the
+rdiff-backup destination directory, or a bug in rdiff-backup""" %
+ (self.mirror_rp.path, self.relevant_incs[-1].lstat()), 2)
+ return cStringIO.StringIO('')
current_fp = self.get_first_fp()
for inc_diff in self.relevant_incs[1:]:
log.Log("Applying patch %s" % (inc_diff.get_indexpath(),), 7)