Patch 9.0.0463

6 views
Skip to first unread message

Bram Moolenaar

unread,
Sep 14, 2022, 7:56:25 AM9/14/22
to vim...@googlegroups.com

Patch 9.0.0463
Problem: Command line test leaves directory behind.
Solution: Use the "R" flag on the first mkdir(). (Dominique Pellé,
closes #11127)
Files: src/testdir/test_cmdline.vim


*** ../vim-9.0.0462/src/testdir/test_cmdline.vim 2022-09-08 16:39:16.912140162 +0100
--- src/testdir/test_cmdline.vim 2022-09-14 12:48:58.222155648 +0100
***************
*** 2149,2155 ****
call VerifyScreenDump(buf, 'Test_wildmenu_pum_13', {})

" Directory name completion
! call mkdir('Xnamedir/XdirA/XdirB', 'p')
call writefile([], 'Xnamedir/XfileA')
call writefile([], 'Xnamedir/XdirA/XfileB')
call writefile([], 'Xnamedir/XdirA/XdirB/XfileC')
--- 2149,2155 ----
call VerifyScreenDump(buf, 'Test_wildmenu_pum_13', {})

" Directory name completion
! call mkdir('Xnamedir/XdirA/XdirB', 'pR')
call writefile([], 'Xnamedir/XfileA')
call writefile([], 'Xnamedir/XdirA/XfileB')
call writefile([], 'Xnamedir/XdirA/XdirB/XfileC')
***************
*** 2229,2235 ****
call VerifyScreenDump(buf, 'Test_wildmenu_pum_31', {})

" Tests a directory name contained full-width characters.
! call mkdir('Xnamedir/あいう', 'pR')
call writefile([], 'Xnamedir/あいう/abc')
call writefile([], 'Xnamedir/あいう/xyz')
call writefile([], 'Xnamedir/あいう/123')
--- 2229,2235 ----
call VerifyScreenDump(buf, 'Test_wildmenu_pum_31', {})

" Tests a directory name contained full-width characters.
! call mkdir('Xnamedir/あいう', 'p')
call writefile([], 'Xnamedir/あいう/abc')
call writefile([], 'Xnamedir/あいう/xyz')
call writefile([], 'Xnamedir/あいう/123')
*** ../vim-9.0.0462/src/version.c 2022-09-14 12:06:45.783430773 +0100
--- src/version.c 2022-09-14 12:50:45.257905492 +0100
***************
*** 705,706 ****
--- 705,708 ----
{ /* Add new patch number below this line */
+ /**/
+ 463,
/**/

--
hundred-and-one symptoms of being an internet addict:
68. Your cat always puts viruses on your dogs homepage

/// Bram Moolenaar -- Br...@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 ///

Dominique Pellé

unread,
Sep 14, 2022, 9:33:31 AM9/14/22
to vim...@googlegroups.com
Bram Moolenaar wrote:

> " Directory name completion
> ! call mkdir('Xnamedir/XdirA/XdirB', 'p')
> call writefile([], 'Xnamedir/XfileA')
> call writefile([], 'Xnamedir/XdirA/XfileB')
> call writefile([], 'Xnamedir/XdirA/XdirB/XfileC')
> --- 2149,2155 ----
> call VerifyScreenDump(buf, 'Test_wildmenu_pum_13', {})
>
> " Directory name completion
> ! call mkdir('Xnamedir/XdirA/XdirB', 'pR')
> call writefile([], 'Xnamedir/XfileA')
> call writefile([], 'Xnamedir/XdirA/XfileB')
> call writefile([], 'Xnamedir/XdirA/XdirB/XfileC')

We only needed the 'R' flag for the root dir XnameDir/ but
anyway it does seem to hurt to have it for subdirectories too.

Regards
Dominique

Bram Moolenaar

unread,
Sep 14, 2022, 12:28:42 PM9/14/22
to vim...@googlegroups.com, Dominique Pellé
It would not hurt, but it can be confusing. The first mkdir() will
create three directories, the top one being "XnameDir". That one will
then add a deferred call to "delete('XnameDir', 'rf')".

The second mkdir() will find that "XnameDir" already exists and only
creates a directory below it. The deferred delete() call when then only
delete what was created, thus "XnameDir" itself won't be affected.

This may seem a bit complicated, but it is required for something like:
mkdir('include/temp', 'pR')

To delete the while "include" directory, while it only created the
"temp" directory inside it. It's a lot safer to only delete what was
created.

--
hundred-and-one symptoms of being an internet addict:
71. You wonder how people walk
Reply all
Reply to author
Forward
0 new messages