Mercurial > vim
comparison src/scriptfile.c @ 32206:5372bf23bf72 v9.0.1434
patch 9.0.1434: crash when adding package already in 'runtimepath'
Commit: https://github.com/vim/vim/commit/39c9ec16ea7ef13c5d783481542ee9aa6c05282c
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sat Apr 1 13:52:03 2023 +0100
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 https://github.com/vim/vim/issues/12215)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 01 Apr 2023 15:00:06 +0200 |
parents | 730eebd56f48 |
children | 6e96bd314ffe |
comparison
equal
deleted
inserted
replaced
32205:4629e7ede81c | 32206:5372bf23bf72 |
---|---|
716 for (entry = p_rtp; *entry != NUL; ) | 716 for (entry = p_rtp; *entry != NUL; ) |
717 { | 717 { |
718 char_u *cur_entry = entry; | 718 char_u *cur_entry = entry; |
719 | 719 |
720 copy_option_part(&entry, buf, MAXPATHL, ","); | 720 copy_option_part(&entry, buf, MAXPATHL, ","); |
721 | |
722 if ((p = (char_u *)strstr((char *)buf, "after")) != NULL | |
723 && p > buf | |
724 && vim_ispathsep(p[-1]) | |
725 && (vim_ispathsep(p[5]) || p[5] == NUL || p[5] == ',')) | |
726 { | |
727 if (insp == NULL) | |
728 // Did not find "ffname" before the first "after" directory, | |
729 // insert it before this entry. | |
730 insp = cur_entry; | |
731 after_insp = cur_entry; | |
732 break; | |
733 } | |
734 | |
721 if (insp == NULL) | 735 if (insp == NULL) |
722 { | 736 { |
723 add_pathsep(buf); | 737 add_pathsep(buf); |
724 rtp_ffname = fix_fname(buf); | 738 rtp_ffname = fix_fname(buf); |
725 if (rtp_ffname == NULL) | 739 if (rtp_ffname == NULL) |
727 match = vim_fnamencmp(rtp_ffname, ffname, fname_len) == 0; | 741 match = vim_fnamencmp(rtp_ffname, ffname, fname_len) == 0; |
728 vim_free(rtp_ffname); | 742 vim_free(rtp_ffname); |
729 if (match) | 743 if (match) |
730 // Insert "ffname" after this entry (and comma). | 744 // Insert "ffname" after this entry (and comma). |
731 insp = entry; | 745 insp = entry; |
732 } | |
733 | |
734 if ((p = (char_u *)strstr((char *)buf, "after")) != NULL | |
735 && p > buf | |
736 && vim_ispathsep(p[-1]) | |
737 && (vim_ispathsep(p[5]) || p[5] == NUL || p[5] == ',')) | |
738 { | |
739 if (insp == NULL) | |
740 // Did not find "ffname" before the first "after" directory, | |
741 // insert it before this entry. | |
742 insp = cur_entry; | |
743 after_insp = cur_entry; | |
744 break; | |
745 } | 746 } |
746 } | 747 } |
747 | 748 |
748 if (insp == NULL) | 749 if (insp == NULL) |
749 // Both "fname" and "after" not found, append at the end. | 750 // Both "fname" and "after" not found, append at the end. |