From: Vladimír Marek Date: Thu, 18 Jun 2026 19:02:56 +0000 (+0000) Subject: patch 9.2.0673: tests: Test_recover_corrupted_swap_file() cannot handle symlinks X-Git-Tag: v9.2.0673^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88cbd003125840ed20f455653e28b91e3237f380;p=thirdparty%2Fvim.git patch 9.2.0673: tests: Test_recover_corrupted_swap_file() cannot handle symlinks Problem: tests: Test_recover_corrupted_swap_file() cannot handle symlinks Solution: Use writefile(readblob()) instead (Vladimír Marek) Test_recover_corrupted_swap_file1() copies prebuilt corrupt swap samples before recovering them. In an out-of-source-tree build those sample files may be symlinks into the source tree. filecopy() preserves symlinks, so the copied target may remain a symlink. Recovery opens swap files with O_NOFOLLOW, so that copied symlink cannot be opened. Read the sample as a blob and write it back so the recovery target is a real swap file. closes: #20561 Signed-off-by: Vladimír Marek Signed-off-by: Christian Brabandt --- diff --git a/src/testdir/test_recover.vim b/src/testdir/test_recover.vim index 69caa89135..bb61e1995d 100644 --- a/src/testdir/test_recover.vim +++ b/src/testdir/test_recover.vim @@ -503,7 +503,9 @@ func Test_recover_corrupted_swap_file1() new let sample = 'samples/recover-crash1.swp' let target = 'Xpoc1.swp' - call filecopy(sample, target) + " In an out-of-source-tree build the sample may be a symlink, this copies the + " data into a real file. + call writefile(readblob(sample), target, 'D') try sil recover! Xpoc1 catch /^Vim\%((\S\+)\)\=:E1364:/ @@ -517,7 +519,9 @@ func Test_recover_corrupted_swap_file1() new let sample = 'samples/recover-crash2.swp' let target = 'Xpoc2.swp' - call filecopy(sample, target) + " In an out-of-source-tree build the sample may be a symlink, this copies the + " data into a real file. + call writefile(readblob(sample), target, 'D') try sil recover! Xpoc2 catch /^Vim\%((\S\+)\)\=:E1364:/ diff --git a/src/version.c b/src/version.c index af26854acb..14ba1f8ed1 100644 --- a/src/version.c +++ b/src/version.c @@ -759,6 +759,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 673, /**/ 672, /**/