浏览代码

fix test_extract_continue

make a hardlink to keep the inode allocated,
so it can not re-use the same inode when it
(deletes and re)creates the file.
Thomas Waldmann 2 年之前
父节点
当前提交
82ccf0c08c
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/borg/testsuite/archiver/extract_cmd.py

+ 4 - 0
src/borg/testsuite/archiver/extract_cmd.py

@@ -635,9 +635,13 @@ class ArchiverTestCase(ArchiverTestCaseBase):
             file1_st = os.stat("input/file1")
             file1_st = os.stat("input/file1")
             # simulate a partially extracted file2 (smaller size, archived mtime not yet set)
             # simulate a partially extracted file2 (smaller size, archived mtime not yet set)
             file2_st = os.stat("input/file2")
             file2_st = os.stat("input/file2")
+            # make a hardlink, so it does not free the inode when unlinking input/file2
+            os.link("input/file2", "hardlink-to-keep-inode-f2")
             os.truncate("input/file2", 123)  # -> incorrect size, incorrect mtime
             os.truncate("input/file2", 123)  # -> incorrect size, incorrect mtime
             # simulate file3 has not yet been extracted
             # simulate file3 has not yet been extracted
             file3_st = os.stat("input/file3")
             file3_st = os.stat("input/file3")
+            # make a hardlink, so it does not free the inode when unlinking input/file3
+            os.link("input/file3", "hardlink-to-keep-inode-f3")
             os.remove("input/file3")
             os.remove("input/file3")
         with changedir("output"):
         with changedir("output"):
             # now try to continue extracting, using the same archive, same output dir:
             # now try to continue extracting, using the same archive, same output dir: