mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.0.1434: crash when adding package already in 'runtimepath'
Problem: Crash when adding package already in 'runtimepath'. Solution: Change order for using 'runtimepath' entries. (closes #12215)
This commit is contained in:
parent
869113f376
commit
39c9ec16ea
@ -718,18 +718,6 @@ add_pack_dir_to_rtp(char_u *fname)
|
|||||||
char_u *cur_entry = entry;
|
char_u *cur_entry = entry;
|
||||||
|
|
||||||
copy_option_part(&entry, buf, MAXPATHL, ",");
|
copy_option_part(&entry, buf, MAXPATHL, ",");
|
||||||
if (insp == NULL)
|
|
||||||
{
|
|
||||||
add_pathsep(buf);
|
|
||||||
rtp_ffname = fix_fname(buf);
|
|
||||||
if (rtp_ffname == NULL)
|
|
||||||
goto theend;
|
|
||||||
match = vim_fnamencmp(rtp_ffname, ffname, fname_len) == 0;
|
|
||||||
vim_free(rtp_ffname);
|
|
||||||
if (match)
|
|
||||||
// Insert "ffname" after this entry (and comma).
|
|
||||||
insp = entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((p = (char_u *)strstr((char *)buf, "after")) != NULL
|
if ((p = (char_u *)strstr((char *)buf, "after")) != NULL
|
||||||
&& p > buf
|
&& p > buf
|
||||||
@ -743,6 +731,19 @@ add_pack_dir_to_rtp(char_u *fname)
|
|||||||
after_insp = cur_entry;
|
after_insp = cur_entry;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (insp == NULL)
|
||||||
|
{
|
||||||
|
add_pathsep(buf);
|
||||||
|
rtp_ffname = fix_fname(buf);
|
||||||
|
if (rtp_ffname == NULL)
|
||||||
|
goto theend;
|
||||||
|
match = vim_fnamencmp(rtp_ffname, ffname, fname_len) == 0;
|
||||||
|
vim_free(rtp_ffname);
|
||||||
|
if (match)
|
||||||
|
// Insert "ffname" after this entry (and comma).
|
||||||
|
insp = entry;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (insp == NULL)
|
if (insp == NULL)
|
||||||
|
@ -21,6 +21,13 @@ func Test_packadd()
|
|||||||
call mkdir(s:plugdir . '/plugin/also', 'p')
|
call mkdir(s:plugdir . '/plugin/also', 'p')
|
||||||
call mkdir(s:plugdir . '/ftdetect', 'p')
|
call mkdir(s:plugdir . '/ftdetect', 'p')
|
||||||
call mkdir(s:plugdir . '/after', 'p')
|
call mkdir(s:plugdir . '/after', 'p')
|
||||||
|
|
||||||
|
" This used to crash Vim
|
||||||
|
let &rtp = 'nosuchdir,' . s:plugdir . '/after'
|
||||||
|
packadd mytest
|
||||||
|
" plugdir should be inserted before plugdir/after
|
||||||
|
call assert_match('^nosuchdir,' . s:plugdir . ',', &rtp)
|
||||||
|
|
||||||
set rtp&
|
set rtp&
|
||||||
let rtp = &rtp
|
let rtp = &rtp
|
||||||
filetype on
|
filetype on
|
||||||
|
@ -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 */
|
||||||
|
/**/
|
||||||
|
1434,
|
||||||
/**/
|
/**/
|
||||||
1433,
|
1433,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user