From a72819b38230bae86b8b222aa5c563aae8e2e730 Mon Sep 17 00:00:00 2001 From: owsla Date: Sat, 14 Jun 2008 16:35:25 +0000 Subject: Fix another case where rdiff-backup fails because it has insufficient permissions on a file it owns. git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@894 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/CHANGELOG | 4 ++++ rdiff-backup/rdiff_backup/increment.py | 21 +++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG index 537eb0c..a8b1f53 100644 --- a/rdiff-backup/CHANGELOG +++ b/rdiff-backup/CHANGELOG @@ -1,6 +1,10 @@ New in v1.1.16 (????/??/??) --------------------------- +Fix another case where rdiff-backup fails because it has insufficient +permissions on a file it owns. Thanks to Peter Schuller for the test +case. (Andrew Ferguson) + Don't abort if can't read extended attributes or ACL because the path is considered bad by the EA/ACL subsystem; print a warning instead. Problem reported by Farkas Levente. (Andrew Ferguson) diff --git a/rdiff-backup/rdiff_backup/increment.py b/rdiff-backup/rdiff_backup/increment.py index f1cdbc8..afab0d2 100644 --- a/rdiff-backup/rdiff_backup/increment.py +++ b/rdiff-backup/rdiff_backup/increment.py @@ -79,13 +79,22 @@ def makediff(new, mirror, incpref): if compress: diff = get_inc(incpref, "diff.gz") else: diff = get_inc(incpref, "diff") - if Globals.process_uid != 0 and not new.readable(): + old_new_perms, old_mirror_perms = (None, None) + + if Globals.process_uid != 0: # Check for unreadable files - old_new_perms = new.getperms() - new.chmod(0400 | old_new_perms) - Rdiff.write_delta(new, mirror, diff, compress) - new.chmod(old_new_perms) - else: Rdiff.write_delta(new, mirror, diff, compress) + if not new.readable(): + old_new_perms = new.getperms() + new.chmod(0400 | old_new_perms) + if not mirror.readable(): + old_mirror_perms = mirror.getperms() + mirror.chmod(0400 | old_mirror_perms) + + Rdiff.write_delta(new, mirror, diff, compress) + + if old_new_perms: new.chmod(old_new_perms) + if old_mirror_perms: mirror.chmod(old_mirror_perms) + rpath.copy_attribs_inc(mirror, diff) return diff -- cgit v1.2.1