diff options
author | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-08-23 23:58:08 +0000 |
---|---|---|
committer | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-08-23 23:58:08 +0000 |
commit | 188794d438954505a5c2effb74ddea5105b8b40e (patch) | |
tree | 0afc825adca627da6661f838e2863c65c2fef3a4 /rdiff-backup/rdiff_backup/backup.py | |
parent | 0cde1ef022765b5763cf68be308553460bcbaadb (diff) | |
download | rdiff-backup-188794d438954505a5c2effb74ddea5105b8b40e.tar.gz |
Mostly fixing unreadable reg root source/non-root dest bug
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/branches/r0-12@400 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/rdiff_backup/backup.py')
-rw-r--r-- | rdiff-backup/rdiff_backup/backup.py | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/rdiff-backup/rdiff_backup/backup.py b/rdiff-backup/rdiff_backup/backup.py index 5040de6..e0a66a2 100644 --- a/rdiff-backup/rdiff_backup/backup.py +++ b/rdiff-backup/rdiff_backup/backup.py @@ -181,15 +181,26 @@ class DestinationStruct: elif dest_rorp: dest_sig = dest_rorp.getRORPath() if dest_rorp.isreg(): - dest_rp = dest_base_rpath.new_index(index) - if not dest_rp.isreg(): - log.ErrorLog.write_if_open("UpdateError", dest_rp, - "File changed from regular file before signature") - return None - dest_sig.setfile(Rdiff.get_signature(dest_rp)) + sig_fp = cls.get_one_sig_fp(dest_base_rpath.new_index(index)) + if sig_fp is None: return None + dest_sig.setfile(sig_fp) else: dest_sig = rpath.RORPath(index) return dest_sig + def get_one_sig_fp(cls, dest_rp): + """Return a signature fp of given index, corresponding to reg file""" + if not dest_rp.isreg(): + log.ErrorLog.write_if_open("UpdateError", dest_rp, + "File changed from regular file before signature") + return None + if Globals.process_uid != 0 and not dest_rp.readable(): + # This branch can happen with root source and non-root + # destination. Permissions are changed permanently, which + # should propogate to the diffs + assert dest_rp.isowner(), 'no ownership of %s' % (dest_rp.path,) + dest_rp.chmod(0400 | dest_rp.getperms()) + return Rdiff.get_signature(dest_rp) + def patch(cls, dest_rpath, source_diffiter, start_index = ()): """Patch dest_rpath with an rorpiter of diffs""" ITR = rorpiter.IterTreeReducer(PatchITRB, [dest_rpath, cls.CCPP]) |