diff options
-rw-r--r-- | rdiff-backup/CHANGELOG | 3 | ||||
-rw-r--r-- | rdiff-backup/rdiff_backup/backup.py | 8 | ||||
-rw-r--r-- | rdiff-backup/rdiff_backup/rpath.py | 8 |
3 files changed, 19 insertions, 0 deletions
diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG index ac9ad69..45ef1e9 100644 --- a/rdiff-backup/CHANGELOG +++ b/rdiff-backup/CHANGELOG @@ -1,6 +1,9 @@ New in v1.3.0 (????/??/??) --------------------------- +Allow rdiff-backup to backup files which it cannot read, but can change +the permissions of. (Andrew Ferguson) + Take start and end times from same system so that the elapsed time printed in the statistics is not affected by time zone. (Andrew Ferguson) diff --git a/rdiff-backup/rdiff_backup/backup.py b/rdiff-backup/rdiff_backup/backup.py index d18c3c0..c314d63 100644 --- a/rdiff-backup/rdiff_backup/backup.py +++ b/rdiff-backup/rdiff_backup/backup.py @@ -110,8 +110,16 @@ class SourceStruct: if dest_sig.isflaglinked(): diff_rorp.flaglinked(dest_sig.get_link_flag()) elif src_rp.isreg(): + reset_perms = False + if (Globals.process_uid != 0 and not src_rp.readable() and + src_rp.isowner()): + reset_perms = True + src_rp.chmod(0400 | src_rp.getperms()) + if dest_sig.isreg(): attach_diff(diff_rorp, src_rp, dest_sig) else: attach_snapshot(diff_rorp, src_rp) + + if reset_perms: src_rp.chmod(src_rp.getperms() & ~0400) else: dest_sig.close_if_necessary() diff_rorp.set_attached_filetype('snapshot') diff --git a/rdiff-backup/rdiff_backup/rpath.py b/rdiff-backup/rdiff_backup/rpath.py index 9bcdd2e..5a94a8b 100644 --- a/rdiff-backup/rdiff_backup/rpath.py +++ b/rdiff-backup/rdiff_backup/rpath.py @@ -1491,6 +1491,11 @@ def setdata_local(rpath): """ assert rpath.conn is Globals.local_connection + reset_perms = False + if (Globals.process_uid != 0 and not rpath.readable() and rpath.isowner()): + reset_perms = True + rpath.chmod(0400 | rpath.getperms()) + rpath.data['uname'] = user_group.uid2uname(rpath.data['uid']) rpath.data['gname'] = user_group.gid2gname(rpath.data['gid']) if Globals.eas_conn: rpath.data['ea'] = ea_get(rpath) @@ -1502,6 +1507,9 @@ def setdata_local(rpath): if Globals.carbonfile_conn and rpath.isreg(): rpath.data['carbonfile'] = carbonfile_get(rpath) + if reset_perms: rpath.chmod(rpath.getperms() & ~0400) + + def carbonfile_get(rpath): """Return carbonfile value for local rpath""" # Note, after we drop support for Mac OS X 10.0 - 10.3, it will no longer |