summaryrefslogtreecommitdiff
path: root/rdiff-backup/rdiff_backup
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-04-05 02:00:22 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-04-05 02:00:22 +0000
commitf2a81b8612ef203367f29d9c3e669c74ea41b009 (patch)
tree1e9c903aae91da011bf15701fe38d21bcb6c251d /rdiff-backup/rdiff_backup
parentc7d46be1a1a152baff70500448c6263dd2246a59 (diff)
downloadrdiff-backup-f2a81b8612ef203367f29d9c3e669c74ea41b009.tar.gz
--windows-mode now implies that permissions will not be changed
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@313 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/rdiff_backup')
-rw-r--r--rdiff-backup/rdiff_backup/Globals.py3
-rw-r--r--rdiff-backup/rdiff_backup/Main.py4
-rw-r--r--rdiff-backup/rdiff_backup/backup.py4
-rw-r--r--rdiff-backup/rdiff_backup/regress.py3
-rw-r--r--rdiff-backup/rdiff_backup/restore.py4
-rw-r--r--rdiff-backup/rdiff_backup/rpath.py2
6 files changed, 13 insertions, 7 deletions
diff --git a/rdiff-backup/rdiff_backup/Globals.py b/rdiff-backup/rdiff_backup/Globals.py
index 2516c13..9deaac4 100644
--- a/rdiff-backup/rdiff_backup/Globals.py
+++ b/rdiff-backup/rdiff_backup/Globals.py
@@ -53,6 +53,9 @@ process_gid = os.getgid()
# If true, when copying attributes, also change target's uid/gid
change_ownership = None
+# If true, when copying attributes, also change target's permission.
+change_permission = 1
+
# If true, change the permissions of unwriteable mirror files
# (such as directories) so that they can be written, and then
# change them back. This defaults to 1 just in case the process
diff --git a/rdiff-backup/rdiff_backup/Main.py b/rdiff-backup/rdiff_backup/Main.py
index c717f05..f1bb21b 100644
--- a/rdiff-backup/rdiff_backup/Main.py
+++ b/rdiff-backup/rdiff_backup/Main.py
@@ -149,6 +149,7 @@ def parse_cmdlineoptions(arglist):
Globals.set('quoting_enabled', 1)
Globals.set('preserve_hardlinks', 0)
Globals.set('change_ownership', 0)
+ Globals.set('change_permission', 0)
Globals.set('fsync_directories', 0)
else: Log.FatalError("Unknown option %s" % opt)
@@ -287,7 +288,8 @@ def backup_init_dirs(rpin, rpout):
if rpout.lstat():
if rpout.isdir() and not rpout.listdir(): # rpout is empty dir
- rpout.chmod(0700) # just make sure permissions aren't too lax
+ if Globals.change_permission:
+ rpout.chmod(0700) # just make sure permissions aren't too lax
elif not datadir.lstat() and not force: Log.FatalError(
"""Destination directory
diff --git a/rdiff-backup/rdiff_backup/backup.py b/rdiff-backup/rdiff_backup/backup.py
index afbde9f..f87b947 100644
--- a/rdiff-backup/rdiff_backup/backup.py
+++ b/rdiff-backup/rdiff_backup/backup.py
@@ -468,7 +468,7 @@ class PatchITRB(rorpiter.ITRBranch):
self.dir_replacement)
success = 0
else: success = 1
- if base_rp.isdir(): base_rp.chmod(0700)
+ if base_rp.isdir() and Globals.change_permission: base_rp.chmod(0700)
return success
def prepare_dir(self, diff_rorp, base_rp):
@@ -481,7 +481,7 @@ class PatchITRB(rorpiter.ITRBranch):
else: # maybe no change, so query CCPP before tagging success
if self.CCPP.in_cache(diff_rorp.index):
self.CCPP.flag_success(diff_rorp.index)
- base_rp.chmod(0700)
+ if Globals.change_permission: base_rp.chmod(0700)
def end_process(self):
"""Finish processing directory"""
diff --git a/rdiff-backup/rdiff_backup/regress.py b/rdiff-backup/rdiff_backup/regress.py
index 1180d2a..cda171a 100644
--- a/rdiff-backup/rdiff_backup/regress.py
+++ b/rdiff-backup/rdiff_backup/regress.py
@@ -244,7 +244,8 @@ class RegressITRB(rorpiter.ITRBranch):
if not rf.mirror_rp.isdir():
if rf.mirror_rp.lstat(): rf.mirror_rp.delete()
rf.mirror_rp.mkdir()
- if not rf.mirror_rp.hasfullperms(): rf.mirror_rp.chmod(0700)
+ if Globals.change_permission and not rf.mirror_rp.hasfullperms():
+ rf.mirror_rp.chmod(0700)
self.rf = rf
def end_process(self):
diff --git a/rdiff-backup/rdiff_backup/restore.py b/rdiff-backup/rdiff_backup/restore.py
index f35b83a..fce386c 100644
--- a/rdiff-backup/rdiff_backup/restore.py
+++ b/rdiff-backup/rdiff_backup/restore.py
@@ -532,7 +532,7 @@ class PatchITRB(rorpiter.ITRBranch):
assert diff_rorp.get_attached_filetype() == 'snapshot'
self.dir_replacement = TempFile.new(base_rp)
rpath.copy_with_attribs(diff_rorp, self.dir_replacement)
- if base_rp.isdir(): base_rp.chmod(0700)
+ if base_rp.isdir() and Globals.change_permission: base_rp.chmod(0700)
def prepare_dir(self, diff_rorp, base_rp):
"""Prepare base_rp to turn into a directory"""
@@ -540,7 +540,7 @@ class PatchITRB(rorpiter.ITRBranch):
if not base_rp.isdir():
if base_rp.lstat(): base_rp.delete()
base_rp.mkdir()
- base_rp.chmod(0700)
+ if Globals.change_permission: base_rp.chmod(0700)
def end_process(self):
"""Finish processing directory"""
diff --git a/rdiff-backup/rdiff_backup/rpath.py b/rdiff-backup/rdiff_backup/rpath.py
index 8c9aa10..da7a518 100644
--- a/rdiff-backup/rdiff_backup/rpath.py
+++ b/rdiff-backup/rdiff_backup/rpath.py
@@ -157,7 +157,7 @@ def copy_attribs(rpin, rpout):
check_for_files(rpin, rpout)
if rpin.issym(): return # symlinks have no valid attributes
if Globals.change_ownership: apply(rpout.chown, rpin.getuidgid())
- rpout.chmod(rpin.getperms())
+ if Globals.change_permission: rpout.chmod(rpin.getperms())
if not rpin.isdev(): rpout.setmtime(rpin.getmtime())
def cmp_attribs(rp1, rp2):