diff options
author | owsla <owsla@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2007-12-24 22:39:47 +0000 |
---|---|---|
committer | owsla <owsla@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2007-12-24 22:39:47 +0000 |
commit | c2df9f46b8a2c81aedceff403f0c49cab09d50b5 (patch) | |
tree | 945961d71c9c63a6560a2834fa7724bf73c34885 /rdiff-backup/rdiff_backup/backup.py | |
parent | 231fe19bbb7c2101db97eef60c28232b0e4e4875 (diff) | |
download | rdiff-backup-c2df9f46b8a2c81aedceff403f0c49cab09d50b5.tar.gz |
- Replace is_readable() function with pre-existing readable() function
- Close Savannah bug #21202 by not assuming that file cannot be opened
even if read permissions don't indicate such.
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@855 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/rdiff_backup/backup.py')
-rw-r--r-- | rdiff-backup/rdiff_backup/backup.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/rdiff-backup/rdiff_backup/backup.py b/rdiff-backup/rdiff_backup/backup.py index 7d24eb7..2b139f4 100644 --- a/rdiff-backup/rdiff_backup/backup.py +++ b/rdiff-backup/rdiff_backup/backup.py @@ -202,14 +202,21 @@ class DestinationStruct: 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(): + if (Globals.process_uid != 0 and not dest_rp.readable() and + dest_rp.isowner()): # 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) - + try: + return Rdiff.get_signature(dest_rp) + except IOError, e: + if (e.errno == errno.EPERM): + log.Log.FatalError("Could not open %s for reading. Check " + "permissions on file." % (dest_rp.path,)) + else: + raise + 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]) |