Commit: patch 9.1.2003: tests: Test_glob_symlinks may fail on Window

1 view
Skip to first unread message

Christian Brabandt

unread,
Dec 21, 2025, 2:15:57 PM (16 hours ago) Dec 21
to vim...@googlegroups.com
patch 9.1.2003: tests: Test_glob_symlinks may fail on Window

Commit: https://github.com/vim/vim/commit/fa2fca1ebf8215987a18e0822e78713639b7534c
Author: Muraoka Taro <koron....@gmail.com>
Date: Sun Dec 21 19:09:20 2025 +0000

patch 9.1.2003: tests: Test_glob_symlinks may fail on Window

Problem: tests: Test_glob_symlinks may fail on Windows with UCRT
runtime
Solution: Comment out the code, do not use _wstat().
(author)

For Test_glob_symlinks() to succeed, vim_stat() (which is actually
mswin_stat_impl()) must fail on empty symlinks. When the dynamically
linked C runtime is linked, _wstat() succeeds even on empty symbolic
links. As a result, Test_glob_symlinks() fails.

For details, see here:
https://github.com/koron/vc-stat-behavior-verification

closes: #18962

Signed-off-by: Muraoka Taro <koron....@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/os_mswin.c b/src/os_mswin.c
index e407b563b..2cf1be9d7 100644
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -407,7 +407,19 @@ mswin_stat_impl(const WCHAR *name, stat_T *stp, const int resolve)
DWORD flag = 0;
WIN32_FIND_DATAW findDataW;

-#ifdef _UCRT
+#if 0 && defined(_UCRT)
+ // This code was disabled because the behavior of MSVC's _wstat (actually
+ // _wstat64) for empty symlinks varies depending on the C runtime you link
+ // to.
+ //
+ // The expected behavior here is for _wstat() to fail for empty symlinks.
+ // The expected behavior occurs when linking to a static runtime. However,
+ // the expected behavior does not occur when linking to a dynamic runtime,
+ // and it succeeds for empty symlinks. This causes Test_glob_symlinks in
+ // test_functions.vim to fail when linking to a dynamic runtime.
+ //
+ // For more details, see:
+ // https://github.com/koron/vc-stat-behavior-verification
if (resolve)
// Universal CRT can handle symlinks properly.
return _wstat(name, stp);
diff --git a/src/version.c b/src/version.c
index 534d365e5..fbadafea2 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2003,
/**/
2002,
/**/
Reply all
Reply to author
Forward
0 new messages