Commit 33625d02 authored by bescoto's avatar bescoto

--windows-mode now implies that permissions will not be changed


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@313 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 022f83ea
Make restores tolerant of missing files Make restores tolerant of missing files
Look into hard linking on windows
---------[ Medium term ]--------------------------------------- ---------[ Medium term ]---------------------------------------
Examine default settings with --windows-mode
Look at Kent Borg's suggestion for restore options and digests. Look at Kent Borg's suggestion for restore options and digests.
Add --list-files-changed-between or similar option, to list files that Add --list-files-changed-between or similar option, to list files that
......
...@@ -306,11 +306,12 @@ rdiff-backup cannot remove-older-than and back up or restore in a ...@@ -306,11 +306,12 @@ rdiff-backup cannot remove-older-than and back up or restore in a
single session. If you want to, for instance, backup a directory and single session. If you want to, for instance, backup a directory and
remove old files in it, you must run rdiff-backup twice. remove old files in it, you must run rdiff-backup twice.
Note that snapshots of deleted files are covered by this operation, so Note that snapshots of deleted files are covered by this operation.
if you deleted a file and backed up two weeks ago, and then run Thus if you deleted a file two weeks ago, backed up immediately
--remove-older-than 10D today, no trace of that file will remain. afterwards, and then ran rdiff-backup with --remove-older-than 10D
Finally, file selection options such as --include and --exclude don't today, no trace of that file would remain. Finally, file selection
affect --remove-older-than. options such as --include and --exclude don't affect
--remove-older-than.
.TP .TP
.BI "--restrict " path .BI "--restrict " path
Require that all file access be inside the given path. This switch, Require that all file access be inside the given path. This switch,
......
...@@ -53,6 +53,9 @@ process_gid = os.getgid() ...@@ -53,6 +53,9 @@ process_gid = os.getgid()
# If true, when copying attributes, also change target's uid/gid # If true, when copying attributes, also change target's uid/gid
change_ownership = None 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 # If true, change the permissions of unwriteable mirror files
# (such as directories) so that they can be written, and then # (such as directories) so that they can be written, and then
# change them back. This defaults to 1 just in case the process # change them back. This defaults to 1 just in case the process
......
...@@ -149,6 +149,7 @@ def parse_cmdlineoptions(arglist): ...@@ -149,6 +149,7 @@ def parse_cmdlineoptions(arglist):
Globals.set('quoting_enabled', 1) Globals.set('quoting_enabled', 1)
Globals.set('preserve_hardlinks', 0) Globals.set('preserve_hardlinks', 0)
Globals.set('change_ownership', 0) Globals.set('change_ownership', 0)
Globals.set('change_permission', 0)
Globals.set('fsync_directories', 0) Globals.set('fsync_directories', 0)
else: Log.FatalError("Unknown option %s" % opt) else: Log.FatalError("Unknown option %s" % opt)
...@@ -287,7 +288,8 @@ def backup_init_dirs(rpin, rpout): ...@@ -287,7 +288,8 @@ def backup_init_dirs(rpin, rpout):
if rpout.lstat(): if rpout.lstat():
if rpout.isdir() and not rpout.listdir(): # rpout is empty dir 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( elif not datadir.lstat() and not force: Log.FatalError(
"""Destination directory """Destination directory
......
...@@ -468,7 +468,7 @@ class PatchITRB(rorpiter.ITRBranch): ...@@ -468,7 +468,7 @@ class PatchITRB(rorpiter.ITRBranch):
self.dir_replacement) self.dir_replacement)
success = 0 success = 0
else: success = 1 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 return success
def prepare_dir(self, diff_rorp, base_rp): def prepare_dir(self, diff_rorp, base_rp):
...@@ -481,7 +481,7 @@ class PatchITRB(rorpiter.ITRBranch): ...@@ -481,7 +481,7 @@ class PatchITRB(rorpiter.ITRBranch):
else: # maybe no change, so query CCPP before tagging success else: # maybe no change, so query CCPP before tagging success
if self.CCPP.in_cache(diff_rorp.index): if self.CCPP.in_cache(diff_rorp.index):
self.CCPP.flag_success(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): def end_process(self):
"""Finish processing directory""" """Finish processing directory"""
......
...@@ -244,7 +244,8 @@ class RegressITRB(rorpiter.ITRBranch): ...@@ -244,7 +244,8 @@ class RegressITRB(rorpiter.ITRBranch):
if not rf.mirror_rp.isdir(): if not rf.mirror_rp.isdir():
if rf.mirror_rp.lstat(): rf.mirror_rp.delete() if rf.mirror_rp.lstat(): rf.mirror_rp.delete()
rf.mirror_rp.mkdir() 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 self.rf = rf
def end_process(self): def end_process(self):
......
...@@ -532,7 +532,7 @@ class PatchITRB(rorpiter.ITRBranch): ...@@ -532,7 +532,7 @@ class PatchITRB(rorpiter.ITRBranch):
assert diff_rorp.get_attached_filetype() == 'snapshot' assert diff_rorp.get_attached_filetype() == 'snapshot'
self.dir_replacement = TempFile.new(base_rp) self.dir_replacement = TempFile.new(base_rp)
rpath.copy_with_attribs(diff_rorp, self.dir_replacement) 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): def prepare_dir(self, diff_rorp, base_rp):
"""Prepare base_rp to turn into a directory""" """Prepare base_rp to turn into a directory"""
...@@ -540,7 +540,7 @@ class PatchITRB(rorpiter.ITRBranch): ...@@ -540,7 +540,7 @@ class PatchITRB(rorpiter.ITRBranch):
if not base_rp.isdir(): if not base_rp.isdir():
if base_rp.lstat(): base_rp.delete() if base_rp.lstat(): base_rp.delete()
base_rp.mkdir() base_rp.mkdir()
base_rp.chmod(0700) if Globals.change_permission: base_rp.chmod(0700)
def end_process(self): def end_process(self):
"""Finish processing directory""" """Finish processing directory"""
......
...@@ -157,7 +157,7 @@ def copy_attribs(rpin, rpout): ...@@ -157,7 +157,7 @@ def copy_attribs(rpin, rpout):
check_for_files(rpin, rpout) check_for_files(rpin, rpout)
if rpin.issym(): return # symlinks have no valid attributes if rpin.issym(): return # symlinks have no valid attributes
if Globals.change_ownership: apply(rpout.chown, rpin.getuidgid()) 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()) if not rpin.isdev(): rpout.setmtime(rpin.getmtime())
def cmp_attribs(rp1, rp2): def cmp_attribs(rp1, rp2):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment