Commit: patch 9.2.0673: tests: Test_recover_corrupted_swap_file() cannot handle symlinks

0 views
Skip to first unread message

Christian Brabandt

unread,
Jun 18, 2026, 3:15:15 PM (11 hours ago) Jun 18
to vim...@googlegroups.com
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 <vlma...@gmail.com>
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 <vlma...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

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,
/**/
Reply all
Reply to author
Forward
0 new messages