summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-08-29 09:21:37 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-08-29 09:21:37 +0000
commit932022a0999659a6d02a076b22bfdc9c567cf87a (patch)
tree56432b7dd316c997decb0f5ccead79b0c7df68b8
parent47e616b933c51731a7e95e3b507e2fe56d8eb351 (diff)
downloadrdiff-backup-932022a0999659a6d02a076b22bfdc9c567cf87a.tar.gz
Unreadable directory fix
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/branches/r0-12@411 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/CHANGELOG7
-rw-r--r--rdiff-backup/rdiff_backup/backup.py20
2 files changed, 21 insertions, 6 deletions
diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG
index 771d788..0dcdd49 100644
--- a/rdiff-backup/CHANGELOG
+++ b/rdiff-backup/CHANGELOG
@@ -4,9 +4,10 @@ New in v0.12.4 (??????????)
Specified socket type as SOCK_STREAM. (Error reported by Erik
Forsberg.)
-Fixed bug backing up unreadable regular files when rdiff-backup is run
-by root on the source site and non-root on the destination side.
-(Reported by Troels Arvin and Arkadiusz Miskiewicz.)
+Fixed bug backing up unreadable regular files and directories when
+rdiff-backup is run by root on the source site and non-root on the
+destination side. (Reported by Troels Arvin and Arkadiusz
+Miskiewicz.)
If there is data missing from the destination dir (for instance if a
user mistakenly deletes it), only warn when restoring, instead of
diff --git a/rdiff-backup/rdiff_backup/backup.py b/rdiff-backup/rdiff_backup/backup.py
index e0a66a2..72888e3 100644
--- a/rdiff-backup/rdiff_backup/backup.py
+++ b/rdiff-backup/rdiff_backup/backup.py
@@ -143,7 +143,7 @@ class DestinationStruct:
dest_iter = cls.get_dest_select(baserp, for_increment)
collated = rorpiter.Collate2Iters(source_iter, dest_iter)
cls.CCPP = CacheCollatedPostProcess(
- collated, Globals.pipeline_max_length*4)
+ collated, Globals.pipeline_max_length*4, baserp)
# pipeline len adds some leeway over just*3 (to and from and back)
def get_sigs(cls, dest_base_rpath):
@@ -226,7 +226,7 @@ static.MakeClass(DestinationStruct)
class CacheCollatedPostProcess:
- """Cache a collated iter of (source_rorp, dest_rp) pairs
+ """Cache a collated iter of (source_rorp, dest_rorp) pairs
This is necessary for two reasons:
@@ -248,10 +248,12 @@ class CacheCollatedPostProcess:
metadata for it.
"""
- def __init__(self, collated_iter, cache_size):
+ def __init__(self, collated_iter, cache_size, dest_root_rp):
"""Initialize new CCWP."""
self.iter = collated_iter # generates (source_rorp, dest_rorp) pairs
self.cache_size = cache_size
+ self.dest_root_rp = dest_root_rp
+
self.statfileobj = statistics.init_statfileobj()
if Globals.file_statistics: statistics.FileStats.init()
metadata.OpenMetadata()
@@ -294,6 +296,10 @@ class CacheCollatedPostProcess:
"""
if source_rorp: Hardlink.add_rorp(source_rorp, source = 1)
if dest_rorp: Hardlink.add_rorp(dest_rorp, source = 0)
+ if (dest_rorp and dest_rorp.isdir() and Globals.process_uid != 0 and
+ dest_rorp.getperms() % 01000 < 0700):
+ dest_rp = self.dest_root_rp.new_index(dest_rorp.index)
+ dest_rp.chmod(0700 | dest_rorp.getperms())
def shorten_cache(self):
"""Remove one element from cache, possibly adding it to metadata"""
@@ -332,6 +338,13 @@ class CacheCollatedPostProcess:
if Globals.file_statistics:
statistics.FileStats.update(source_rorp, dest_rorp, changed, inc)
+ # Update permissions of unreadable directory
+ if (source_rorp and source_rorp.isdir() and Globals.process_uid != 0
+ and success and source_rorp.getperms() % 01000 < 0700):
+ dest_rp = self.dest_root_rp.new_index(source_rorp.index)
+ assert dest_rp.isdir(), dest_rp
+ dest_rp.chmod(source_rorp.getperms())
+
def in_cache(self, index):
"""Return true if given index is cached"""
return self.cache_dict.has_key(index)
@@ -580,3 +593,4 @@ class IncrementITRB(PatchITRB):
self.CCPP.set_inc(index, inc)
self.CCPP.flag_success(index)
+