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.kaoriya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Muraoka Taro
2025-12-21 19:09:20 +00:00
committed by Christian Brabandt
parent c1d77520b8
commit fa2fca1ebf
2 changed files with 15 additions and 1 deletions
+13 -1
View File
@@ -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);
+2
View File
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2003,
/**/
2002,
/**/