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 -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230401125317.D8EFE1C0E9C%40moolenaar.net.

Raspunde prin e-mail lui