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

Josh Gao jmgao at google.com
Tue Oct 25 21:22:34 PDT 2016


On Fri, Oct 21, 2016 at 9:22 AM, Rob Landley <rob at landley.net> wrote:
>
> The problem is without that chmod -R goes nuts.
>

Whoops, sorry. I probably shouldn't send out patches written immediately
before leaving work :-)

On Sat, Oct 22, 2016 at 1:43 PM, Rob Landley <rob at landley.net> wrote:

> 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
>

POSIX says: If either of the files dot or dot-dot are specified as the
basename portion of an operand (that is, the final pathname component), rm
shall write a diagnostic message to standard error and do nothing more with
such operands. (
http://pubs.opengroup.org/onlinepubs/007904975/utilities/rm.html)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20161025/da1cfe89/attachment-0003.htm>


More information about the Toybox mailing list