Commit ba916303 authored by bescoto's avatar bescoto

Only warn, not AssertionError, if can't get restore fp


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@327 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent ce09f23f
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
"""Read increment files and restore to original""" """Read increment files and restore to original"""
from __future__ import generators from __future__ import generators
import tempfile, os import tempfile, os, cStringIO
import Globals, Time, Rdiff, Hardlink, rorpiter, selection, rpath, \ import Globals, Time, Rdiff, Hardlink, rorpiter, selection, rpath, \
log, static, robust, metadata, statistics, TempFile log, static, robust, metadata, statistics, TempFile
...@@ -381,8 +381,16 @@ class RestoreFile: ...@@ -381,8 +381,16 @@ class RestoreFile:
def get_restore_fp(self): def get_restore_fp(self):
"""Return file object of restored data""" """Return file object of restored data"""
assert self.relevant_incs[-1].isreg(), \ if not self.relevant_incs[-1].isreg():
(mirror_rp.index, self.relevant_incs[-1].lstat()) 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() current_fp = self.get_first_fp()
for inc_diff in self.relevant_incs[1:]: for inc_diff in self.relevant_incs[1:]:
log.Log("Applying patch %s" % (inc_diff.get_indexpath(),), 7) log.Log("Applying patch %s" % (inc_diff.get_indexpath(),), 7)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment