From 4a631e0ba92c7a7aea25dfeb36f645b55c51e856 Mon Sep 17 00:00:00 2001 From: owsla Date: Mon, 22 Dec 2008 19:25:06 +0000 Subject: Print a more helpful message if we get an error while attempting to read an old current_mirror marker. git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@980 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/CHANGELOG | 5 +++++ rdiff-backup/rdiff_backup/Main.py | 20 ++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG index 91fd619..941ebc1 100644 --- a/rdiff-backup/CHANGELOG +++ b/rdiff-backup/CHANGELOG @@ -1,6 +1,11 @@ New in v1.2.3 (????/??/??) --------------------------- +Print a more helpful error message if we get an error while reading an old +current_mirror marker. This can happen because it has been locked or deleted +by a just-finished rdiff-backup process. Closes Ubuntu bugs #88140 and +#284506. (Andrew Ferguson) + Do not backup reparse points on native Windows. Thanks to John Covici for reporting the issue. (Andrew Ferguson) diff --git a/rdiff-backup/rdiff_backup/Main.py b/rdiff-backup/rdiff_backup/Main.py index e8e964b..d4aa48a 100644 --- a/rdiff-backup/rdiff_backup/Main.py +++ b/rdiff-backup/rdiff_backup/Main.py @@ -424,7 +424,10 @@ def fix_failed_initial_backup(): def backup_set_rbdir(rpin, rpout): """Initialize data dir and logging""" global incdir - incdir = Globals.rbdir.append_path("increments") + try: + incdir = Globals.rbdir.append_path("increments") + except (OSError, IOError), exc: + Log.FatalError("Could not begin backup due to\n%s" % exc) assert rpout.lstat(), (rpout.path, rpout.lstat()) if rpout.isdir() and not rpout.listdir(): # rpout is empty dir @@ -543,7 +546,11 @@ def Restore(src_rp, dest_rp, restore_as_of = None): Log.FatalError("Could not find rdiff-backup repository at " + src_rp.path) restore_check_paths(src_rp, dest_rp, restore_as_of) - dest_rp.conn.fs_abilities.restore_set_globals(dest_rp) + try: + dest_rp.conn.fs_abilities.restore_set_globals(dest_rp) + except (OSError, IOError), exc: + print "\n" + Log.FatalError("Could not begin backup due to\n%s" % exc) 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) @@ -710,7 +717,7 @@ def require_root_set(rp, read_only): try: Globals.rbdir.conn.fs_abilities.single_set_globals(Globals.rbdir, read_only) - except IOError, exc: + except (OSError, IOError), exc: print("\n") Log.FatalError("Could not open rdiff-backup directory\n\n%s\n\n" "due to\n\n%s" % (Globals.rbdir.path, exc)) @@ -876,7 +883,12 @@ information in it. """ % (Globals.rbdir.path,)) elif len(curmir_incs) == 1: return 0 else: - if not force: curmir_incs[0].conn.regress.check_pids(curmir_incs) + if not force: + try: + curmir_incs[0].conn.regress.check_pids(curmir_incs) + except (OSError, IOError), exc: + Log.FatalError("Could not check if rdiff-backup is currently" + "running due to\n%s" % exc) assert len(curmir_incs) == 2, "Found too many current_mirror incs!" return 1 -- cgit v1.2.1