summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-07-18 09:41:14 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-07-18 09:41:14 +0000
commite9a90e94befd8aaf5185be59d13d946d8b121936 (patch)
tree815bcb103a91d825a42a8cc4869a4b45c43e78d7
parent7d75e73ffa5310b7ed74b81807ca32c652f0b866 (diff)
downloadrdiff-backup-e9a90e94befd8aaf5185be59d13d946d8b121936.tar.gz
Added detection of directory increment permission limitation
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@344 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/rdiff_backup/Main.py3
-rw-r--r--rdiff-backup/rdiff_backup/fs_abilities.py25
-rw-r--r--rdiff-backup/testing/fs_abilitiestest.py3
3 files changed, 27 insertions, 4 deletions
diff --git a/rdiff-backup/rdiff_backup/Main.py b/rdiff-backup/rdiff_backup/Main.py
index 40fca1c..6e2af52 100644
--- a/rdiff-backup/rdiff_backup/Main.py
+++ b/rdiff-backup/rdiff_backup/Main.py
@@ -343,6 +343,9 @@ def backup_set_fs_globals(rpin, rpout):
SetConnections.UpdateGlobal('write_eas',
Globals.read_eas and dest_fsa.eas)
SetConnections.UpdateGlobal('change_ownership', dest_fsa.ownership)
+ if Globals.change_dir_inc_perms is None:
+ SetConnections.UpdateGlobal('change_dir_inc_perms',
+ dest_fsa.dir_inc_perms)
SetConnections.UpdateGlobal('chars_to_quote', dest_fsa.chars_to_quote)
if Globals.chars_to_quote:
for conn in Globals.connections:
diff --git a/rdiff-backup/rdiff_backup/fs_abilities.py b/rdiff-backup/rdiff_backup/fs_abilities.py
index 6ef26ea..c4dc509 100644
--- a/rdiff-backup/rdiff_backup/fs_abilities.py
+++ b/rdiff-backup/rdiff_backup/fs_abilities.py
@@ -39,7 +39,8 @@ class FSAbilities:
hardlinks = None # True if hard linking supported
fsync_dirs = None # True if directories can be fsync'd
read_only = None # True if capabilities were determined non-destructively
- name = None #
+ dir_inc_perms = None # True if regular files can have full permissions
+ name = None # Short string, not used for any technical purpose
def __init__(self, name = None):
"""FSAbilities initializer. name is only used in logging"""
@@ -61,10 +62,11 @@ class FSAbilities:
addline('Characters needing quoting', ctq_str)
for desc, val in [('Ownership changing', self.ownership),
- ('Access Control Lists', self.acls),
- ('Extended Attributes', self.eas),
+ ('Access control lists', self.acls),
+ ('Extended attributes', self.eas),
('Hard linking', self.hardlinks),
- ('fsync() directories', self.fsync_dirs)]:
+ ('fsync() directories', self.fsync_dirs),
+ ('Directory inc permissions', self.dir_inc_perms)]:
if val: val_text = 'On'
elif val is None: val_text = 'N/A'
else:
@@ -118,6 +120,7 @@ class FSAbilities:
self.set_fsync_dirs(subdir)
self.set_eas(subdir, 1)
self.set_acls(subdir)
+ self.set_dir_inc_perms(subdir)
if override_chars_to_quote is None: self.set_chars_to_quote(subdir)
else: self.chars_to_quote = override_chars_to_quote
if use_ctq_file: self.compare_chars_to_quote(rbdir)
@@ -240,6 +243,20 @@ rdiff-backup-data/chars_to_quote.
"""Set extended attributes from rp. Tests writing if write is true."""
self.eas = rp.conn.fs_abilities.test_eas_local(rp, write)
+ def set_dir_inc_perms(self, rp):
+ """See if increments can have full permissions like a directory"""
+ test_rp = rp.append('dir_inc_check')
+ test_rp.touch()
+ try: test_rp.chmod(07777)
+ except OSError:
+ test_rp.delete()
+ self.dir_inc_perms = 0
+ return
+ test_rp.setdata()
+ assert test_rp.isreg()
+ if test_rp.getperms() == 07777: self.dir_inc_perms = 1
+ else: self.dir_inc_perms = 0
+ test_rp.delete()
def test_eas_local(rp, write):
"""Test ea support. Must be called locally. Usedy by set_eas above."""
diff --git a/rdiff-backup/testing/fs_abilitiestest.py b/rdiff-backup/testing/fs_abilitiestest.py
index c40b3c0..c16ab46 100644
--- a/rdiff-backup/testing/fs_abilitiestest.py
+++ b/rdiff-backup/testing/fs_abilitiestest.py
@@ -17,6 +17,7 @@ class FSAbilitiesTest(unittest.TestCase):
chars_to_quote = ""
ownership = (os.getuid() == 0)
hardlinks = fsync_dirs = 1
+ dir_inc_perms = 1
# Describes MS-Windows style file system
#dir_to_test = "/mnt/fat"
@@ -24,6 +25,7 @@ class FSAbilitiesTest(unittest.TestCase):
#chars_to_quote = "^a-z0-9_ -"
#ownership = hardlinks = 0
#fsync_dirs = 1
+ #dir_inc_perms = XXX
def testReadOnly(self):
"""Test basic querying read only"""
@@ -52,6 +54,7 @@ class FSAbilitiesTest(unittest.TestCase):
assert fsa.ownership == self.ownership, fsa.ownership
assert fsa.hardlinks == self.hardlinks, fsa.hardlinks
assert fsa.fsync_dirs == self.fsync_dirs, fsa.fsync_dirs
+ assert fsa.dir_inc_perms == self.dir_inc_perms, fsa.dir_inc_perms
ctq_rp = new_dir.append("chars_to_quote")
assert ctq_rp.lstat()