Commit: patch 9.2.0993: runtime(netrw): error when parent dir of g:netrw_home doesn't exist

Christian Brabandt <[email protected]>
Newsgroups gmane.editors.vim.devel
Message-ID <[email protected]>
patch 9.2.0993: runtime(netrw): error when parent dir of g:netrw_home doesn't exist

Commit: https://github.com/vim/vim/commit/ffce1ce58dd3d08110c35c8af61ad2555b344569
Author: zeertzjq <[email protected]>
Date:   Fri Aug 21 15:05:33 2026 +0000

    patch 9.2.0993: runtime(netrw): error when parent dir of g:netrw_home doesn't exist
    
    Problem:  netrw: error when parent dir of g:netrw_home doesn't exist.
    Solution: Use 'p' flag of mkdir() (zeertzjq).
    
    closes: #21113
    
    Signed-off-by: zeertzjq <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/pack/dist/opt/netrw/autoload/netrw.vim b/runtime/pack/dist/opt/netrw/autoload/netrw.vim
index 0347ec497..d8a1c8aad 100644
--- a/runtime/pack/dist/opt/netrw/autoload/netrw.vim
+++ b/runtime/pack/dist/opt/netrw/autoload/netrw.vim
@@ -1,7 +1,7 @@
 " Creator:    Charles E Campbell
 " Previous Maintainer: Luca Saccarola <[email protected]>
 " Maintainer: This runtime file is looking for a new maintainer.
-" Last Change: 2026 Aug 19
+" Last Change: 2026 Aug 21
 " Copyright:  Copyright (C) 2016 Charles E. Campbell {{{1
 "             Permission is hereby granted to use and distribute this code,
 "             with or without modifications, provided that this copyright
@@ -4485,7 +4485,7 @@ function s:NetrwHome()
         if exists("g:netrw_mkdir")
             call system(g:netrw_mkdir." ".s:ShellEscape(s:NetrwFile(home)))
         else
-            call mkdir(home)
+            call mkdir(home, 'p')
         endif
     endif
 
diff --git a/src/testdir/test_plugin_netrw.vim b/src/testdir/test_plugin_netrw.vim
index e6ce769ce..db837aa8f 100644
--- a/src/testdir/test_plugin_netrw.vim
+++ b/src/testdir/test_plugin_netrw.vim
@@ -919,9 +919,11 @@ endfunc
 
 func Test_netrw_home_setting()
   let save_home = get(g:, 'netrw_home', '')
-  let dir = fnamemodify('XnetrwHome', ':p:h')
+  let dir = fnamemodify('XnetrwHome', ':p')
+  let subdir = fnamemodify('XnetrwHomeParent/XnetrwHome', ':p')
   if has('win32')
     let dir = substitute(dir, '/', '\', 'g')
+    let subdir = substitute(subdir, '/', '\', 'g')
   endif
  
   if has('nvim')
@@ -933,6 +935,10 @@ func Test_netrw_home_setting()
   call assert_equal(dir, Test_NetrwHome())
   call assert_true(isdirectory(dir))
 
+  let g:netrw_home = subdir
+  call assert_equal(subdir, Test_NetrwHome())
+  call assert_true(isdirectory(subdir))
+
   " the value is expanded
   let $NETRW_TEST_HOME = dir
   let g:netrw_home = '$NETRW_TEST_HOME'
@@ -944,6 +950,8 @@ func Test_netrw_home_setting()
   call assert_equal(dir, Test_NetrwHome())
 
   call delete(dir, 'd')
+  call delete(subdir, 'd')
+  call delete(fnamemodify(subdir, ':h'), 'd')
   let $NETRW_TEST_HOME = ''
   if empty(save_home)
     unlet! g:netrw_home
diff --git a/src/version.c b/src/version.c
index efbbd9cc6..410454557 100644
--- a/src/version.c
+++ b/src/version.c
@@ -763,6 +763,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    993,
 /**/
     992,
 /**/

-- 
-- 
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 visit https://groups.google.com/d/msgid/vim_dev/E1wxQxX-00FPmZ-UO%40256bit.org.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.