To: vim_dev@googlegroups.com Subject: Patch 9.0.1434 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1434 Problem: Crash when adding package already in 'runtimepath'. Solution: Change order for using 'runtimepath' entries. (closes #12215) Files: src/scriptfile.c, src/testdir/test_packadd.vim *** ../vim-9.0.1433/src/scriptfile.c 2023-03-30 21:50:31.138608063 +0100 --- src/scriptfile.c 2023-04-01 13:44:27.505824465 +0100 *************** *** 718,735 **** char_u *cur_entry = entry; 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 && p > buf --- 718,723 ---- *************** *** 743,748 **** --- 731,749 ---- after_insp = cur_entry; 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) *** ../vim-9.0.1433/src/testdir/test_packadd.vim 2023-01-25 15:04:17.939549253 +0000 --- src/testdir/test_packadd.vim 2023-04-01 13:44:27.505824465 +0100 *************** *** 21,26 **** --- 21,33 ---- call mkdir(s:plugdir . '/plugin/also', 'p') call mkdir(s:plugdir . '/ftdetect', '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& let rtp = &rtp filetype on *** ../vim-9.0.1433/src/version.c 2023-03-31 21:28:57.363659525 +0100 --- src/version.c 2023-04-01 13:46:07.089921141 +0100 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1434, /**/ -- Windows M!uqoms /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///