<div dir="ltr">On Fri, Oct 21, 2016 at 9:22 AM, Rob Landley <span dir="ltr"><<a href="mailto:rob@landley.net" target="_blank">rob@landley.net</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The problem is without that chmod -R goes nuts.<span class="gmail-HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>Whoops, sorry. I probably shouldn't send out patches written immediately before leaving work :-)</div><div><br></div><div class="gmail_extra"><div class="gmail_quote">On Sat, Oct 22, 2016 at 1:43 PM, Rob Landley <span dir="ltr"><<a href="mailto:rob@landley.net" target="_blank">rob@landley.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">So the design issue this raises is that if you directly do stuff on the<br>
current or previous directories, ala "find . -type f", it should work.<br>
I.E. dirtree_notdotdot() should be if (node->parent) dirtree_notdotdot();<br>
<br>
There are several places that already test this (like find), and some<br>
that move the notdotdot test later in the function, but it seems like<br>
what should happen is notdotdot() should have the ->parent test<br>
internally. Except:<br>
<br>
mkdir sub<br>
cd sub<br>
touch walrus<br>
rm -rf .<br>
<br>
Complains it can't delete sub (understood, strace on "rmdir ." says the<br>
kernel's returning EINVAL when you try to do that but will happily let<br>
_another_ process do that to you), but does NOT delete walrus (huh? You<br>
can't delete a directory until you've deleted its contents anyway...?<br>
strace says it doesn't even try...?)<br>
<br>
I don't see anything in the rm spec (or man page) about this? <br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-HOEnZb"><font color="#888888">
Rob<br>
</font></span></blockquote><div><br>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. (<a href="http://pubs.opengroup.org/onlinepubs/007904975/utilities/rm.html">http://pubs.opengroup.org/onlinepubs/007904975/utilities/rm.html</a>)</div></div></div></div>