summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-05-20 19:26:02 +0000
committerben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-05-20 19:26:02 +0000
commit91a5369ef256424d0cc38434c7fd4f4aac1264bd (patch)
tree17954d13780197e1cbaab5e3ef4e446fa27bfea6
parent1f4e957cd505f5cd3bcb6902e266b5bad6b17209 (diff)
downloadrdiff-backup-91a5369ef256424d0cc38434c7fd4f4aac1264bd.tar.gz
Various bug fixes so it passes tests
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@93 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/rdiff_backup/header.py2
-rw-r--r--rdiff-backup/rdiff_backup/highlevel.py14
-rw-r--r--rdiff-backup/rdiff_backup/robust.py22
-rw-r--r--rdiff-backup/rdiff_backup/selection.py4
-rw-r--r--rdiff-backup/src/globals.py2
-rw-r--r--rdiff-backup/src/header.py2
-rw-r--r--rdiff-backup/src/highlevel.py14
-rwxr-xr-xrdiff-backup/src/main.py4
-rw-r--r--rdiff-backup/src/rdiff.py4
-rw-r--r--rdiff-backup/src/robust.py22
-rw-r--r--rdiff-backup/src/selection.py4
11 files changed, 47 insertions, 47 deletions
diff --git a/rdiff-backup/rdiff_backup/header.py b/rdiff-backup/rdiff_backup/header.py
index 71ca7d2..4e1de8e 100644
--- a/rdiff-backup/rdiff_backup/header.py
+++ b/rdiff-backup/rdiff_backup/header.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
#
# rdiff-backup -- Mirror files while keeping incremental changes
-# Version 0.7.4 released May 11, 2002
+# Version 0.7.5 released May 20, 2002
# Copyright (C) 2001, 2002 Ben Escoto <bescoto@stanford.edu>
#
# This program is licensed under the GNU General Public License (GPL).
diff --git a/rdiff-backup/rdiff_backup/highlevel.py b/rdiff-backup/rdiff_backup/highlevel.py
index 36ac997..e1cfc28 100644
--- a/rdiff-backup/rdiff_backup/highlevel.py
+++ b/rdiff-backup/rdiff_backup/highlevel.py
@@ -100,11 +100,11 @@ class HLSourceStruct:
if dest_sig:
if dest_sig.isplaceholder(): yield dest_sig
else:
- try: yield RORPIter.diffonce(dest_sig, dsrp)
- except (IOError, OSError, RdiffException):
- Log.exception()
- Log("Error producing a diff of %s" %
- dsrp and dsrp.path)
+ diff = Robust.check_common_error(
+ lambda: RORPIter.diffonce(dest_sig, dsrp),
+ lambda exc: Log("Error %s producing a diff of %s" %
+ (str(exc), dsrp and dsrp.path), 2))
+ if diff: yield diff
if dsrp: finalizer(dsrp.index, dsrp)
finalizer.Finish()
return diffs()
@@ -269,10 +269,10 @@ class HLDestinationStruct:
"""Run thunk, catch certain errors skip files"""
try: return thunk()
except (EnvironmentError, SkipFileException, DSRPPermError,
- RPathException), exp:
+ RPathException), exc:
Log.exception()
if (not isinstance(exc, EnvironmentError) or
- (errno.errorcode[exp[0]] in
+ (errno.errorcode[exc[0]] in
['EPERM', 'ENOENT', 'EACCES', 'EBUSY', 'EEXIST',
'ENOTDIR', 'ENAMETOOLONG', 'EINTR', 'ENOTEMPTY',
'EIO', # reported by docv
diff --git a/rdiff-backup/rdiff_backup/robust.py b/rdiff-backup/rdiff_backup/robust.py
index a5b1056..e92a701 100644
--- a/rdiff-backup/rdiff_backup/robust.py
+++ b/rdiff-backup/rdiff_backup/robust.py
@@ -1,4 +1,4 @@
-import tempfile
+import tempfile, errno
execfile("hardlink.py")
#######################################################################
@@ -56,10 +56,10 @@ class RobustAction:
try:
self.init_thunk()
self.final_thunk()
- except Exception, exp: # Catch all errors
+ except Exception, exc: # Catch all errors
Log.exception()
- self.error_thunk(exp)
- raise exp
+ self.error_thunk(exc)
+ raise exc
class Robust:
@@ -79,8 +79,8 @@ class Robust:
ra.init_thunk()
def final():
for ra in robust_action_list: ra.final_thunk()
- def error(exp):
- for ra in ras_with_completed_inits: ra.error_thunk(exp)
+ def error(exc):
+ for ra in ras_with_completed_inits: ra.error_thunk(exc)
return RobustAction(init, final, error)
def chain_nested(robust_action_list):
@@ -94,8 +94,8 @@ class Robust:
ralist_copy = robust_action_list[:]
ralist_copy.reverse()
for ra in ralist_copy: ra.final_thunk()
- def error(exp):
- for ra in ras_with_completed_inits: ra.error_thunk(exp)
+ def error(exc):
+ for ra in ras_with_completed_inits: ra.error_thunk(exc)
return RobustAction(init, final, error)
def make_tf_robustaction(init_thunk, tempfiles, final_renames = None):
@@ -118,7 +118,7 @@ class Robust:
if final_name.isdir(): # Cannot rename over directory
final_name.delete()
tempfiles[i].rename(final_name)
- def error(exp):
+ def error(exc):
for tf in tempfiles: tf.delete()
return RobustAction(init_thunk, final, error)
@@ -203,7 +203,7 @@ class Robust:
RPathException), exc:
Log.exception()
if (not isinstance(exc, EnvironmentError) or
- (errno.errorcode[exp[0]] in
+ (errno.errorcode[exc[0]] in
['EPERM', 'ENOENT', 'EACCES', 'EBUSY', 'EEXIST',
'ENOTDIR', 'ENAMETOOLONG', 'EINTR', 'ENOTEMPTY',
'EIO', # reported by docv
@@ -363,7 +363,7 @@ class SaveState:
('increments',) + last_file_rorp.index)
return Robust.symlink_action(cls._last_file_sym, symtext)
else: return RobustAction(lambda: None, cls.touch_last_file,
- lambda exp: None)
+ lambda exc: None)
def checkpoint_inc_backup(cls, ITR, finalizer, last_file_rorp,
override = None):
diff --git a/rdiff-backup/rdiff_backup/selection.py b/rdiff-backup/rdiff_backup/selection.py
index 0bb46e2..94da6f1 100644
--- a/rdiff-backup/rdiff_backup/selection.py
+++ b/rdiff-backup/rdiff_backup/selection.py
@@ -283,12 +283,12 @@ probably isn't what you meant.""" %
for line in filelist_fp:
if not line.strip(): continue # skip blanks
try: tuple = self.filelist_parse_line(line, include)
- except FilePrefixError, exp:
+ except FilePrefixError, exc:
prefix_warnings += 1
if prefix_warnings < 6:
Log("Warning: file specification %s in filelist %s\n"
"doesn't start with correct prefix %s, ignoring." %
- (exp, filelist_name, self.prefix), 2)
+ (exc, filelist_name, self.prefix), 2)
if prefix_warnings == 5:
Log("Future prefix errors will not be logged.", 2)
tuple_list.append(tuple)
diff --git a/rdiff-backup/src/globals.py b/rdiff-backup/src/globals.py
index 7d62733..a06eb61 100644
--- a/rdiff-backup/src/globals.py
+++ b/rdiff-backup/src/globals.py
@@ -8,7 +8,7 @@ import re, os
class Globals:
# The current version of rdiff-backup
- version = "0.7.4"
+ version = "0.7.5"
# If this is set, use this value in seconds as the current time
# instead of reading it from the clock.
diff --git a/rdiff-backup/src/header.py b/rdiff-backup/src/header.py
index 71ca7d2..4e1de8e 100644
--- a/rdiff-backup/src/header.py
+++ b/rdiff-backup/src/header.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
#
# rdiff-backup -- Mirror files while keeping incremental changes
-# Version 0.7.4 released May 11, 2002
+# Version 0.7.5 released May 20, 2002
# Copyright (C) 2001, 2002 Ben Escoto <bescoto@stanford.edu>
#
# This program is licensed under the GNU General Public License (GPL).
diff --git a/rdiff-backup/src/highlevel.py b/rdiff-backup/src/highlevel.py
index 36ac997..e1cfc28 100644
--- a/rdiff-backup/src/highlevel.py
+++ b/rdiff-backup/src/highlevel.py
@@ -100,11 +100,11 @@ class HLSourceStruct:
if dest_sig:
if dest_sig.isplaceholder(): yield dest_sig
else:
- try: yield RORPIter.diffonce(dest_sig, dsrp)
- except (IOError, OSError, RdiffException):
- Log.exception()
- Log("Error producing a diff of %s" %
- dsrp and dsrp.path)
+ diff = Robust.check_common_error(
+ lambda: RORPIter.diffonce(dest_sig, dsrp),
+ lambda exc: Log("Error %s producing a diff of %s" %
+ (str(exc), dsrp and dsrp.path), 2))
+ if diff: yield diff
if dsrp: finalizer(dsrp.index, dsrp)
finalizer.Finish()
return diffs()
@@ -269,10 +269,10 @@ class HLDestinationStruct:
"""Run thunk, catch certain errors skip files"""
try: return thunk()
except (EnvironmentError, SkipFileException, DSRPPermError,
- RPathException), exp:
+ RPathException), exc:
Log.exception()
if (not isinstance(exc, EnvironmentError) or
- (errno.errorcode[exp[0]] in
+ (errno.errorcode[exc[0]] in
['EPERM', 'ENOENT', 'EACCES', 'EBUSY', 'EEXIST',
'ENOTDIR', 'ENAMETOOLONG', 'EINTR', 'ENOTEMPTY',
'EIO', # reported by docv
diff --git a/rdiff-backup/src/main.py b/rdiff-backup/src/main.py
index b27dad7..94e5729 100755
--- a/rdiff-backup/src/main.py
+++ b/rdiff-backup/src/main.py
@@ -348,7 +348,7 @@ went wrong during your last backup? Using """ + mirrorrps[-1].path, 2)
"""
self.restore_check_paths(rpin, target, 1)
try: time = Time.genstrtotime(self.restore_timestr)
- except TimeError, exp: Log.FatalError(str(exp))
+ except TimeError, exc: Log.FatalError(str(exc))
self.restore_common(rpin, target, time)
def restore_common(self, rpin, target, time):
@@ -456,7 +456,7 @@ Try restoring from an increment file (the filenames look like
(datadir.path,))
try: time = Time.genstrtotime(self.remove_older_than_string)
- except TimeError, exp: Log.FatalError(str(exp))
+ except TimeError, exc: Log.FatalError(str(exc))
timep = Time.timetopretty(time)
Log("Deleting increment(s) before %s" % timep, 4)
diff --git a/rdiff-backup/src/rdiff.py b/rdiff-backup/src/rdiff.py
index 3ad80b3..3b5ba95 100644
--- a/rdiff-backup/src/rdiff.py
+++ b/rdiff-backup/src/rdiff.py
@@ -107,7 +107,7 @@ class Rdiff:
delta_tf = TempFileManager.new(rp_out, None)
def init(): delta_tf.write_from_fileobj(delta_fileobj)
return Robust.chain_nested([RobustAction(init, delta_tf.delete,
- lambda exp: delta_tf.delete),
+ lambda exc: delta_tf.delete),
Rdiff.patch_action(rp_basis, delta_tf,
rp_out, out_tf)])
@@ -130,7 +130,7 @@ class Rdiff:
return Robust.chain(Rdiff.write_delta_action(rpout, rpin, delta_tf),
Rdiff.patch_action(rpout, delta_tf),
RobustAction(lambda: None, delta_tf.delete,
- lambda exp: delta_tf.delete))
+ lambda exc: delta_tf.delete))
MakeStatic(Rdiff)
diff --git a/rdiff-backup/src/robust.py b/rdiff-backup/src/robust.py
index a5b1056..e92a701 100644
--- a/rdiff-backup/src/robust.py
+++ b/rdiff-backup/src/robust.py
@@ -1,4 +1,4 @@
-import tempfile
+import tempfile, errno
execfile("hardlink.py")
#######################################################################
@@ -56,10 +56,10 @@ class RobustAction:
try:
self.init_thunk()
self.final_thunk()
- except Exception, exp: # Catch all errors
+ except Exception, exc: # Catch all errors
Log.exception()
- self.error_thunk(exp)
- raise exp
+ self.error_thunk(exc)
+ raise exc
class Robust:
@@ -79,8 +79,8 @@ class Robust:
ra.init_thunk()
def final():
for ra in robust_action_list: ra.final_thunk()
- def error(exp):
- for ra in ras_with_completed_inits: ra.error_thunk(exp)
+ def error(exc):
+ for ra in ras_with_completed_inits: ra.error_thunk(exc)
return RobustAction(init, final, error)
def chain_nested(robust_action_list):
@@ -94,8 +94,8 @@ class Robust:
ralist_copy = robust_action_list[:]
ralist_copy.reverse()
for ra in ralist_copy: ra.final_thunk()
- def error(exp):
- for ra in ras_with_completed_inits: ra.error_thunk(exp)
+ def error(exc):
+ for ra in ras_with_completed_inits: ra.error_thunk(exc)
return RobustAction(init, final, error)
def make_tf_robustaction(init_thunk, tempfiles, final_renames = None):
@@ -118,7 +118,7 @@ class Robust:
if final_name.isdir(): # Cannot rename over directory
final_name.delete()
tempfiles[i].rename(final_name)
- def error(exp):
+ def error(exc):
for tf in tempfiles: tf.delete()
return RobustAction(init_thunk, final, error)
@@ -203,7 +203,7 @@ class Robust:
RPathException), exc:
Log.exception()
if (not isinstance(exc, EnvironmentError) or
- (errno.errorcode[exp[0]] in
+ (errno.errorcode[exc[0]] in
['EPERM', 'ENOENT', 'EACCES', 'EBUSY', 'EEXIST',
'ENOTDIR', 'ENAMETOOLONG', 'EINTR', 'ENOTEMPTY',
'EIO', # reported by docv
@@ -363,7 +363,7 @@ class SaveState:
('increments',) + last_file_rorp.index)
return Robust.symlink_action(cls._last_file_sym, symtext)
else: return RobustAction(lambda: None, cls.touch_last_file,
- lambda exp: None)
+ lambda exc: None)
def checkpoint_inc_backup(cls, ITR, finalizer, last_file_rorp,
override = None):
diff --git a/rdiff-backup/src/selection.py b/rdiff-backup/src/selection.py
index 0bb46e2..94da6f1 100644
--- a/rdiff-backup/src/selection.py
+++ b/rdiff-backup/src/selection.py
@@ -283,12 +283,12 @@ probably isn't what you meant.""" %
for line in filelist_fp:
if not line.strip(): continue # skip blanks
try: tuple = self.filelist_parse_line(line, include)
- except FilePrefixError, exp:
+ except FilePrefixError, exc:
prefix_warnings += 1
if prefix_warnings < 6:
Log("Warning: file specification %s in filelist %s\n"
"doesn't start with correct prefix %s, ignoring." %
- (exp, filelist_name, self.prefix), 2)
+ (exc, filelist_name, self.prefix), 2)
if prefix_warnings == 5:
Log("Future prefix errors will not be logged.", 2)
tuple_list.append(tuple)