summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorowsla <owsla@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2009-03-09 14:27:18 +0000
committerowsla <owsla@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2009-03-09 14:27:18 +0000
commitd7df659b48360b0566cdbd8c0d987b17340bf453 (patch)
tree3616b0cee9c347add593ae5ab9b223187dae81c0
parent81e5644f932698a1daeef44f2f85b5f7dba3e4da (diff)
downloadrdiff-backup-d7df659b48360b0566cdbd8c0d987b17340bf453.tar.gz
Suppress traceback if permission error during restore
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@1043 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/CHANGELOG3
-rw-r--r--rdiff-backup/rdiff_backup/Main.py33
2 files changed, 27 insertions, 9 deletions
diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG
index 372fb98..ab23b95 100644
--- a/rdiff-backup/CHANGELOG
+++ b/rdiff-backup/CHANGELOG
@@ -1,6 +1,9 @@
New in v1.3.3 (????/??/??)
---------------------------
+Improve handling of incorrect permissions on backup repository during restore
+operation. Closes Ubuntu bug #329722. (Andrew Ferguson)
+
Don't crash on zlib errors. Closes Debian bug #518531. (Andrew Ferguson)
Make sticky bit warnings quieter while determining file system abilities.
diff --git a/rdiff-backup/rdiff_backup/Main.py b/rdiff-backup/rdiff_backup/Main.py
index 139f44f..d111dc9 100644
--- a/rdiff-backup/rdiff_backup/Main.py
+++ b/rdiff-backup/rdiff_backup/Main.py
@@ -20,7 +20,7 @@
"""Start (and end) here - read arguments, set global settings, etc."""
from __future__ import generators
-import getopt, sys, re, os, cStringIO, tempfile, time
+import getopt, sys, re, os, cStringIO, tempfile, time, errno
from log import Log, LoggerError, ErrorLog
import Globals, Time, SetConnections, selection, robust, rpath, \
manage, backup, connection, restore, FilenameMapping, \
@@ -429,8 +429,12 @@ def backup_set_rbdir(rpin, rpout):
global incdir
try:
incdir = Globals.rbdir.append_path("increments")
- except (OSError, IOError), exc:
- Log.FatalError("Could not begin backup due to\n%s" % exc)
+ except IOError, exc:
+ if exc.errno == errno.EACCES:
+ print "\n"
+ Log.FatalError("Could not begin backup due to\n%s" % exc)
+ else:
+ raise
assert rpout.lstat(), (rpout.path, rpout.lstat())
if rpout.isdir() and not rpout.listdir(): # rpout is empty dir
@@ -564,9 +568,12 @@ def Restore(src_rp, dest_rp, restore_as_of = None):
restore_check_paths(src_rp, dest_rp, restore_as_of)
try:
dest_rp.conn.fs_abilities.restore_set_globals(dest_rp)
- except (OSError, IOError), exc:
- print "\n"
- Log.FatalError("Could not begin restore due to\n%s" % exc)
+ except IOError, exc:
+ if exc.errno == errno.EACCES:
+ print "\n"
+ Log.FatalError("Could not begin restore due to\n%s" % exc)
+ else:
+ raise
init_user_group_mapping(dest_rp.conn)
src_rp = restore_init_quoting(src_rp)
restore_check_backup_dir(restore_root, src_rp, restore_as_of)
@@ -577,9 +584,17 @@ def Restore(src_rp, dest_rp, restore_as_of = None):
else: time = src_rp.getinctime()
restore_set_select(restore_root, dest_rp)
restore_start_log(src_rp, dest_rp, time)
- restore.Restore(restore_root.new_index(restore_index),
- inc_rpath, dest_rp, time)
- Log("Restore finished", 4)
+ try:
+ restore.Restore(restore_root.new_index(restore_index),
+ inc_rpath, dest_rp, time)
+ except IOError, exc:
+ if exc.errno == errno.EACCES:
+ print "\n"
+ Log.FatalError("Could not complete restore due to\n%s" % exc)
+ else:
+ raise
+ else:
+ Log("Restore finished", 4)
def restore_init_quoting(src_rp):
"""Change rpaths into quoted versions of themselves if necessary"""