mirror of
https://github.com/vim/vim.git
synced 2025-09-29 04:34:16 -04:00
patch 9.0.1769: executable() ignoring symlinks on Windows
Problem: executable() ignoring symlinks on Windows Solution: resolve reparse points closes: #12562 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: AmberArr <me@frost.moe>
This commit is contained in:
committed by
Christian Brabandt
parent
9f29621415
commit
f5d0f54790
@@ -1775,7 +1775,11 @@ is_reparse_point_included(LPCWSTR fname)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char_u *
|
/*
|
||||||
|
* Return the resolved file path, NULL if "fname" is an AppExecLink reparse
|
||||||
|
* point, already fully resolved, or it doesn't exists.
|
||||||
|
*/
|
||||||
|
char_u *
|
||||||
resolve_reparse_point(char_u *fname)
|
resolve_reparse_point(char_u *fname)
|
||||||
{
|
{
|
||||||
HANDLE h = INVALID_HANDLE_VALUE;
|
HANDLE h = INVALID_HANDLE_VALUE;
|
||||||
|
@@ -2720,6 +2720,8 @@ executable_file(char *name, char_u **path)
|
|||||||
if (attrs & FILE_ATTRIBUTE_REPARSE_POINT)
|
if (attrs & FILE_ATTRIBUTE_REPARSE_POINT)
|
||||||
{
|
{
|
||||||
char_u *res = resolve_appexeclink((char_u *)name);
|
char_u *res = resolve_appexeclink((char_u *)name);
|
||||||
|
if (res == NULL)
|
||||||
|
res = resolve_reparse_point((char_u *)name);
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
// The path is already absolute.
|
// The path is already absolute.
|
||||||
|
@@ -37,6 +37,7 @@ int mch_print_text_out(char_u *p, int len);
|
|||||||
void mch_print_set_font(int iBold, int iItalic, int iUnderline);
|
void mch_print_set_font(int iBold, int iItalic, int iUnderline);
|
||||||
void mch_print_set_bg(long_u bgcol);
|
void mch_print_set_bg(long_u bgcol);
|
||||||
void mch_print_set_fg(long_u fgcol);
|
void mch_print_set_fg(long_u fgcol);
|
||||||
|
char_u *resolve_reparse_point(char_u *fname);
|
||||||
char_u *mch_resolve_path(char_u *fname, int reparse_point);
|
char_u *mch_resolve_path(char_u *fname, int reparse_point);
|
||||||
void win32_set_foreground(void);
|
void win32_set_foreground(void);
|
||||||
void serverInitMessaging(void);
|
void serverInitMessaging(void);
|
||||||
|
@@ -1818,6 +1818,10 @@ func Test_Executable()
|
|||||||
let [pathext, $PATHEXT] = [$PATHEXT, '.com;.exe;.bat;.cmd']
|
let [pathext, $PATHEXT] = [$PATHEXT, '.com;.exe;.bat;.cmd']
|
||||||
call assert_equal(notepadbat, exepath('notepad'))
|
call assert_equal(notepadbat, exepath('notepad'))
|
||||||
let $PATHEXT = pathext
|
let $PATHEXT = pathext
|
||||||
|
" check for symbolic link
|
||||||
|
execute 'silent !mklink np.bat "' .. notepadbat .. '"'
|
||||||
|
call assert_equal(1, executable('./np.bat'))
|
||||||
|
call assert_equal(1, executable('./np'))
|
||||||
bwipe
|
bwipe
|
||||||
eval 'Xnotedir'->delete('rf')
|
eval 'Xnotedir'->delete('rf')
|
||||||
elseif has('unix')
|
elseif has('unix')
|
||||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1769,
|
||||||
/**/
|
/**/
|
||||||
1768,
|
1768,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user