diff options
author | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-09-28 04:34:39 +0000 |
---|---|---|
committer | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-09-28 04:34:39 +0000 |
commit | 325ba37502ba34ddb76ec10f9166d7fdd2bab024 (patch) | |
tree | 2e2703d2e128d30a34743a9f6231caa7f77cd587 /rdiff-backup/rdiff_backup/regress.py | |
parent | 4d274a0bdb3d27b54b946de8f930e2acfd786dcf (diff) | |
download | rdiff-backup-325ba37502ba34ddb76ec10f9166d7fdd2bab024.tar.gz |
Added tests and fixes for restore/regress permission bug
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/branches/r0-12@456 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/rdiff_backup/regress.py')
-rw-r--r-- | rdiff-backup/rdiff_backup/regress.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/rdiff-backup/rdiff_backup/regress.py b/rdiff-backup/rdiff_backup/regress.py index b4e630f..b619fea 100644 --- a/rdiff-backup/rdiff_backup/regress.py +++ b/rdiff-backup/rdiff_backup/regress.py @@ -112,14 +112,29 @@ def remove_rbdir_increments(): old_current_mirror.delete() def iterate_raw_rfs(mirror_rp, inc_rp): - """Iterate all RegressFile objects in mirror/inc directory""" + """Iterate all RegressFile objects in mirror/inc directory + + Also changes permissions of unreadable files to allow access and + then changes them back later. + + """ root_rf = RegressFile(mirror_rp, inc_rp, restore.get_inclist(inc_rp)) def helper(rf): + mirror_rp = rf.mirror_rp + if (Globals.process_uid != 0 and + ((mirror_rp.isreg() and not mirror_rp.readable()) or + (mirror_rp.isdir() and not mirror_rp.hasfullperms()))): + unreadable, old_perms = 1, mirror_rp.getperms() + if mirror_rp.isreg(): mirror_rp.chmod(0400 | old_perms) + else: mirror_rp.chmod(0700 | old_perms) + else: unreadable = 0 yield rf + if unreadable and mirror_rp.isreg(): mirror_rp.chmod(old_perms) if rf.mirror_rp.isdir() or rf.inc_rp.isdir(): for sub_rf in rf.yield_sub_rfs(): for sub_sub_rf in helper(sub_rf): yield sub_sub_rf + if unreadable and mirror_rp.isdir(): mirror_rp.chmod(old_perms) return helper(root_rf) def yield_metadata(): |