Commit 1094fcc1 authored by ben's avatar ben

No longer crash on bad checkpoint data


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@171 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 0151c096
......@@ -6,6 +6,12 @@ Man page now correctly included in rpm.
rdiff-backup script does not have exec permissions until it is
installed (thanks Jason Piterak).
Sockets are now replicated. Why not? (Suggestion by Mickey Everts)
Bad resuming information (because, say, it is left over from a
previous version) should no longer cause exit, except when --resume is
specified.
New in v0.9.3 (2002/07/15)
--------------------------
......
......@@ -40,9 +40,7 @@ static/class methods extensively, and these were only added in version
defaults to an early version, you'll probably have to change the first
line of the rdiff-backup script. For instance, you could set it to:
<pre>
#/usr/bin/env python2.2
</pre>
<pre>#!/usr/bin/env python2.2</pre>
</li>
<a name="verbosity">
......
Write some better selection test cases to test new Iterate_fast func.
If not resuming, don't crash on badly written checkpoint_data.
Fix crash that can occur when exception is found in the middle of a
file (duplicate by backing up /proc remotely). (John Goerzen)
Copy sockets (Mickey Everts)
---------[ Long term ]---------------------------------------
......
......@@ -481,6 +481,10 @@ class SaveState:
MakeClass(SaveState)
class ResumeException(Exception):
"""Indicates some error has been encountered while trying to resume"""
pass
class Resume:
"""Check for old aborted backups and resume if necessary"""
_session_info_list = None # List of ResumeSessionInfo's, sorted by time
......@@ -525,7 +529,9 @@ class Resume:
times = rp_quad_dict.keys()
times.sort()
for time in times:
silist.append(cls.quad_to_si(time, rp_quad_dict[time]))
try: silist.append(cls.quad_to_si(time, rp_quad_dict[time]))
except ResumeException:
Log("Bad resume information found, skipping", 2)
cls._session_info_list = silist
def get_relevant_rps(cls):
......@@ -562,7 +568,8 @@ class Resume:
def quad_to_si(cls, time, quad):
"""Take time, quadlist, return associated ResumeSessionInfo"""
increment_sym, mirror_sym, checkpoint_rp, last_definitive = quad
assert not (increment_sym and mirror_sym) # both shouldn't exist
if increment_sym and mirror_sym:
raise ResumeException("both mirror and inc sym shouldn't exist")
ITR, finalizer = None, None
if increment_sym:
mirror = None
......@@ -574,6 +581,7 @@ class Resume:
last_index = cls.sym_to_index(mirror_sym)
if checkpoint_rp:
finalizer = cls.unpickle_checkpoint(checkpoint_rp)
else: raise ResumeException("Missing increment or mirror sym")
return ResumeSessionInfo(mirror, time, last_index, last_definitive,
finalizer, ITR)
......@@ -598,7 +606,9 @@ class Resume:
fp = checkpoint_rp.open("rb")
data = fp.read()
fp.close()
return cPickle.loads(data)
try: result = cPickle.loads(data)
except cPickle.UnpicklingError:
raise ResumeException("Bad pickle at %s" % (checkpoint_rp.path,))
def ResumeCheck(cls):
"""Return relevant ResumeSessionInfo if there's one we should resume
......
......@@ -481,6 +481,10 @@ class SaveState:
MakeClass(SaveState)
class ResumeException(Exception):
"""Indicates some error has been encountered while trying to resume"""
pass
class Resume:
"""Check for old aborted backups and resume if necessary"""
_session_info_list = None # List of ResumeSessionInfo's, sorted by time
......@@ -525,7 +529,9 @@ class Resume:
times = rp_quad_dict.keys()
times.sort()
for time in times:
silist.append(cls.quad_to_si(time, rp_quad_dict[time]))
try: silist.append(cls.quad_to_si(time, rp_quad_dict[time]))
except ResumeException:
Log("Bad resume information found, skipping", 2)
cls._session_info_list = silist
def get_relevant_rps(cls):
......@@ -562,7 +568,8 @@ class Resume:
def quad_to_si(cls, time, quad):
"""Take time, quadlist, return associated ResumeSessionInfo"""
increment_sym, mirror_sym, checkpoint_rp, last_definitive = quad
assert not (increment_sym and mirror_sym) # both shouldn't exist
if increment_sym and mirror_sym:
raise ResumeException("both mirror and inc sym shouldn't exist")
ITR, finalizer = None, None
if increment_sym:
mirror = None
......@@ -574,6 +581,7 @@ class Resume:
last_index = cls.sym_to_index(mirror_sym)
if checkpoint_rp:
finalizer = cls.unpickle_checkpoint(checkpoint_rp)
else: raise ResumeException("Missing increment or mirror sym")
return ResumeSessionInfo(mirror, time, last_index, last_definitive,
finalizer, ITR)
......@@ -598,7 +606,9 @@ class Resume:
fp = checkpoint_rp.open("rb")
data = fp.read()
fp.close()
return cPickle.loads(data)
try: result = cPickle.loads(data)
except cPickle.UnpicklingError:
raise ResumeException("Bad pickle at %s" % (checkpoint_rp.path,))
def ResumeCheck(cls):
"""Return relevant ResumeSessionInfo if there's one we should resume
......
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