Browse Source

add a test for unreadable parent dir, see #7746

Thomas Waldmann 1 year ago
parent
commit
453d35fa47
1 changed files with 10 additions and 0 deletions
  1. 10 0
      src/borg/testsuite/archiver.py

+ 10 - 0
src/borg/testsuite/archiver.py

@@ -487,6 +487,16 @@ class ArchiverTestCase(ArchiverTestCaseBase):
         self.cmd('init', '--encryption=none', '--make-parent-dirs', repository_location)
         assert os.path.exists(parent_path)
 
+    def test_create_unreadable_parent(self):
+        parent_dir = os.path.join(self.input_path, 'parent')
+        root_dir = os.path.join(self.input_path, 'parent', 'root')
+        os.mkdir(parent_dir)
+        os.mkdir(root_dir)
+        os.chmod(parent_dir, 0o111)  # --x--x--x == parent dir traversable, but not readable
+        self.cmd('init', '--encryption=none', self.repository_location)
+        # issue #7746: we *can* read root_dir and we *can* traverse parent_dir, so this should work:
+        self.cmd('create', self.repository_location + '::test', root_dir)
+
     def test_unix_socket(self):
         self.cmd('init', '--encryption=repokey', self.repository_location)
         try: