patch 9.2.0673: tests: Test_recover_corrupted_swap_file() cannot handle symlinks
Commit: https://github.com/vim/vim/commit/88cbd003125840ed20f455653e28b91e3237f380 Author: Vladimír Marek <[email protected]> Date: Thu Jun 18 19:02:56 2026 +0000 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 <[email protected]> Signed-off-by: Christian Brabandt <[email protected]> diff --git a/src/testdir/test_recover.vim b/src/testdir/test_recover.vim index 69caa8913..bb61e1995 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 af26854ac..14ba1f8ed 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, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1waICg-004PMX-7x%40256bit.org.
