From f2a81b8612ef203367f29d9c3e669c74ea41b009 Mon Sep 17 00:00:00 2001 From: bescoto Date: Sat, 5 Apr 2003 02:00:22 +0000 Subject: --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 --- rdiff-backup/TODO | 4 ++++ rdiff-backup/rdiff-backup.1 | 11 ++++++----- rdiff-backup/rdiff_backup/Globals.py | 3 +++ rdiff-backup/rdiff_backup/Main.py | 4 +++- rdiff-backup/rdiff_backup/backup.py | 4 ++-- rdiff-backup/rdiff_backup/regress.py | 3 ++- rdiff-backup/rdiff_backup/restore.py | 4 ++-- rdiff-backup/rdiff_backup/rpath.py | 2 +- 8 files changed, 23 insertions(+), 12 deletions(-) diff --git a/rdiff-backup/TODO b/rdiff-backup/TODO index 5ae9cb0..7787e74 100644 --- a/rdiff-backup/TODO +++ b/rdiff-backup/TODO @@ -1,7 +1,11 @@ Make restores tolerant of missing files +Look into hard linking on windows + ---------[ Medium term ]--------------------------------------- +Examine default settings with --windows-mode + Look at Kent Borg's suggestion for restore options and digests. Add --list-files-changed-between or similar option, to list files that diff --git a/rdiff-backup/rdiff-backup.1 b/rdiff-backup/rdiff-backup.1 index a24a8ba..69e1a2c 100644 --- a/rdiff-backup/rdiff-backup.1 +++ b/rdiff-backup/rdiff-backup.1 @@ -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 remove old files in it, you must run rdiff-backup twice. -Note that snapshots of deleted files are covered by this operation, so -if you deleted a file and backed up two weeks ago, and then run ---remove-older-than 10D today, no trace of that file will remain. -Finally, file selection options such as --include and --exclude don't -affect --remove-older-than. +Note that snapshots of deleted files are covered by this operation. +Thus if you deleted a file two weeks ago, backed up immediately +afterwards, and then ran rdiff-backup with --remove-older-than 10D +today, no trace of that file would remain. Finally, file selection +options such as --include and --exclude don't affect +--remove-older-than. .TP .BI "--restrict " path Require that all file access be inside the given path. This switch, 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): -- cgit v1.2.1