[Toybox] [PATCH] Make chmod work on . and ..

Rob Landley rob at landley.net
Sat Oct 22 13:43:18 PDT 2016


On 10/20/2016 10:16 PM, Josh Gao wrote:
> Trivial patch actually attached...

Hmmm...

So the design issue this raises is that if you directly do stuff on the
current or previous directories, ala "find . -type f", it should work.
I.E. dirtree_notdotdot() should be if (node->parent) dirtree_notdotdot();

There are several places that already test this (like find), and some
that move the notdotdot test later in the function, but it seems like
what should happen is notdotdot() should have the ->parent test
internally. Except:

  mkdir sub
  cd sub
  touch walrus
  rm -rf .

Complains it can't delete sub (understood, strace on "rmdir ." says the
kernel's returning EINVAL when you try to do that but will happily let
_another_ process do that to you), but does NOT delete walrus (huh? You
can't delete a directory until you've deleted its contents anyway...?
strace says it doesn't even try...?)

I don't see anything in the rm spec (or man page) about this?

Rob



More information about the Toybox mailing list