vim-patch:8.0.0308

Problem:    When using a symbolic link, the package path will not be inserted
            at the right position in 'runtimepath'. (Dugan Chen, Norio Takagi)
Solution:   Resolve symbolic links when finding the right position in
            'runtimepath'. (Hirohito Higashi)

2f9e575583
This commit is contained in:
James McCoy
2017-08-21 12:10:15 -04:00
parent 9ff0cc7085
commit a66eca78c2
3 changed files with 57 additions and 13 deletions

View File

@@ -2498,6 +2498,7 @@ static int APP_BOTH;
static void add_pack_plugin(char_u *fname, void *cookie)
{
char_u *p4, *p3, *p2, *p1, *p;
char_u *buf = NULL;
char *const ffname = fix_fname((char *)fname);
@@ -2525,26 +2526,30 @@ static void add_pack_plugin(char_u *fname, void *cookie)
// Find "ffname" in "p_rtp", ignoring '/' vs '\' differences
size_t fname_len = strlen(ffname);
const char *insp = (const char *)p_rtp;
for (;;) {
if (path_fnamencmp(insp, ffname, fname_len) == 0) {
buf = try_malloc(MAXPATHL);
if (buf == NULL) {
goto theend;
}
while (*insp != NUL) {
copy_option_part((char_u **)&insp, buf, MAXPATHL, ",");
add_pathsep((char *)buf);
char *const rtp_ffname = fix_fname((char *)buf);
if (rtp_ffname == NULL) {
goto theend;
}
bool match = path_fnamencmp(rtp_ffname, ffname, fname_len) == 0;
xfree(rtp_ffname);
if (match) {
break;
}
insp = strchr(insp, ',');
if (insp == NULL) {
break;
}
insp++;
}
if (insp == NULL) {
if (*insp == NUL) {
// not found, append at the end
insp = (const char *)p_rtp + STRLEN(p_rtp);
} else {
// append after the matching directory.
insp += strlen(ffname);
while (*insp != NUL && *insp != ',') {
insp++;
}
insp--;
}
*p4 = c;
@@ -2614,6 +2619,7 @@ static void add_pack_plugin(char_u *fname, void *cookie)
}
theend:
xfree(buf);
xfree(ffname);
}

View File

@@ -644,7 +644,7 @@ static const int included_patches[] = {
311,
// 310,
// 309,
// 308,
308,
307,
// 306,
// 305,