]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.1.1417: MS-Windows: resolve() does not resolve all components of path v8.1.1417
authorBram Moolenaar <Bram@vim.org>
Wed, 29 May 2019 18:36:54 +0000 (20:36 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 29 May 2019 18:36:54 +0000 (20:36 +0200)
Problem:    MS-Windows: resolve() does not resolve all components of the path.
            (David Briscoe)
Solution:   Do not bail out for a reparse point. (Yasuhiro Matsumoto,
            closes #4211, closes #4447)

src/os_mswin.c
src/testdir/test_functions.vim
src/version.c

index 869c9a002dfe932f7cbf50344edc041b95e8b758..2b878f77cf6a3bccadbe7b56b71033c683e02d72 100644 (file)
@@ -1787,12 +1787,6 @@ resolve_reparse_point(char_u *fname)
     if (p == NULL)
        goto fail;
 
-    if ((GetFileAttributesW(p) & FILE_ATTRIBUTE_REPARSE_POINT) == 0)
-    {
-       vim_free(p);
-       goto fail;
-    }
-
     h = CreateFileW(p, 0, 0, NULL, OPEN_EXISTING,
            FILE_FLAG_BACKUP_SEMANTICS, NULL);
     vim_free(p);
index 3e4c03cdbe9523b99a0d1c0eec962419911800c0..cc1ee8b6138c747c09d3bf1de3d365b807b9d55b 100644 (file)
@@ -238,7 +238,7 @@ endfunc
 func s:normalize_fname(fname)
   let ret = substitute(a:fname, '\', '/', 'g')
   let ret = substitute(ret, '//', '/', 'g')
-  let ret = tolower(ret)
+  return tolower(ret)
 endfunc
 
 func Test_resolve_win32()
@@ -330,6 +330,19 @@ func Test_resolve_win32()
     echomsg 'skipped test for buffer name'
   endif
   call delete('Xfile')
+
+  " test for reparse point
+  call mkdir('Xdir')
+  silent !mklink /D Xdirlink Xdir
+  if !v:shell_error
+    w Xdir/text.txt
+    call assert_equal(s:normalize_fname(getcwd() . '\Xdir\text.txt'), s:normalize_fname(resolve('Xdirlink\text.txt')))
+    call assert_equal(s:normalize_fname(getcwd() . '\Xdir'), s:normalize_fname(resolve('Xdirlink')))
+  else
+    echomsg 'skipped test for reparse point'
+  endif
+
+  call delete('Xdir', 'rf')
 endfunc
 
 func Test_simplify()
index b0323470227c7f27a777738694c6579fedf84a57..38b51f79e18bca5303e06a55d4ec833f66ed5027 100644 (file)
@@ -767,6 +767,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1417,
 /**/
     1416,
 /**/