Patch 8.2.4696
Problem: delete() with "rf" argument does not report a failure.
Solution: Return -1 if the directory could not be removed. (closes #10078)
Files: src/fileio.c, src/testdir/test_functions.vim
*** ../vim-8.2.4695/src/fileio.c 2022-03-22 20:42:09.174172862 +0000
--- src/fileio.c 2022-04-05 15:28:05.988648300 +0100
***************
*** 5017,5029 ****
vim_snprintf((char *)NameBuff, MAXPATHL, "%s/%s", exp,
((char_u **)ga.ga_data)[i]);
if (delete_recursive(NameBuff) != 0)
result = -1;
}
ga_clear_strings(&ga);
}
else
result = -1;
- (void)mch_rmdir(exp);
vim_free(exp);
}
else
--- 5017,5032 ----
vim_snprintf((char *)NameBuff, MAXPATHL, "%s/%s", exp,
((char_u **)ga.ga_data)[i]);
if (delete_recursive(NameBuff) != 0)
+ // Remember the failure but continue deleting any further
+ // entries.
result = -1;
}
ga_clear_strings(&ga);
+ if (mch_rmdir(exp) != 0)
+ result = -1;
}
else
result = -1;
vim_free(exp);
}
else
*** ../vim-8.2.4695/src/testdir/test_functions.vim 2022-04-03
11:58:28.014196270 +0100
--- src/testdir/test_functions.vim 2022-04-05 15:26:12.564799977 +0100
***************
*** 2242,2247 ****
--- 2242,2256 ----
call assert_equal(0, delete('Xdir', 'rf'))
call assert_false(filereadable('Xdir/foo.txt'))
call assert_false(filereadable('Xdir/[a-1]/foo.txt'))
+
+ if has('unix')
+ call mkdir('Xdir/Xdir2', 'p')
+ silent !chmod 555 Xdir
+ call assert_equal(-1, delete('Xdir/Xdir2', 'rf'))
+ call assert_equal(-1, delete('Xdir', 'rf'))
+ silent !chmod 755 Xdir
+ call assert_equal(0, delete('Xdir', 'rf'))
+ endif
endfunc
func Test_call()
*** ../vim-8.2.4695/src/version.c 2022-04-05 15:07:28.246741272 +0100
--- src/version.c 2022-04-05 15:30:00.308498243 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4696,
/**/
--
A programmer's wife asks him: "Please run to the store and pick up a loaf of
bread. If they have eggs, get a dozen". The programmer comes home with 12
loafs of bread.
/// 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/20220405143138.D6C281C0561%40moolenaar.net.