From 82ccf0c08c19e612e2f62414e77a3f210b4bde75 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Tue, 16 May 2023 18:43:07 +0200 Subject: [PATCH] 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. --- src/borg/testsuite/archiver/extract_cmd.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/borg/testsuite/archiver/extract_cmd.py b/src/borg/testsuite/archiver/extract_cmd.py index db1b3e4d2..e6bcaf2f8 100644 --- a/src/borg/testsuite/archiver/extract_cmd.py +++ b/src/borg/testsuite/archiver/extract_cmd.py @@ -635,9 +635,13 @@ def test_extract_continue(self): file1_st = os.stat("input/file1") # simulate a partially extracted file2 (smaller size, archived mtime not yet set) 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 # simulate file3 has not yet been extracted 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") with changedir("output"): # now try to continue extracting, using the same archive, same output dir: