[Toybox] rm -rf doesn't chmod high enough
Felix Janda
felix.janda at posteo.de
Sat Sep 20 06:22:49 PDT 2014
Isaac Dunham wrote:
[..]
> A trickier bug is that rm -r dir will skip dir, saying
> "rm: dir: is a directory"
> I guess the fix involves rm -r calling rmdir instead of unlink.
unlinkat() also removes directories when given AT_REMOVEDIR.
The following patch makes rm pass the tests and it still asks
me when I try to remove a readonly dir.
-Felix
diff -r 434c4ae19f05 toys/posix/rm.c
--- a/toys/posix/rm.c Thu Sep 18 18:07:58 2014 -0500
+++ b/toys/posix/rm.c Sat Sep 20 15:19:09 2014 +0200
@@ -50,7 +50,6 @@
// Handle chmod 000 directories when -f
if (faccessat(fd, try->name, R_OK, AT_SYMLINK_NOFOLLOW)) {
if (toys.optflags & FLAG_f) wfchmodat(fd, try->name, 0700);
- else goto skip;
}
if (!try->again) return DIRTREE_COMEAGAIN;
using = AT_REMOVEDIR;
1411219369.0
More information about the Toybox
mailing list