<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Dec 18, 2020 at 3:10 AM Rob Landley <<a href="mailto:rob@landley.net">rob@landley.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 12/16/20 4:39 PM, enh wrote:<br>
>     While doing that, apparently host chmod -f on a directory that doesn't currently<br>
>     exist returns an error (which would make your && not continue and recreate it).<br>
>     rm -f thingy is happen if thingy doesn't already exist, but chmod -f isn't.<br>
> <br>
> <br>
> i should have said "only tested on macOS".<br>
<br>
Which I can't test on here, so may break...<br>
<br>
Sigh, this whole thing would be moot if tests/rm.test:<br>
<br>
  mkdir -p one && touch one/two && chmod 000 one<br>
  toyonly testing "-rf 000 dir" \<br>
    "rm -rf one 2>/dev/null && [ ! -e one ] && echo yes" "yes\n" "" ""<br>
  chmod 777 one 2>/dev/null ; rm -rf one<br>
<br>
wasn't "toyonly". MY rm got that part right.<br>
<br>
I don't remember if I made dirtree work at infinite depth yet, though. I came up<br>
with a design for it, don't think I actually implemented it yet? That's both a<br>
posix requirement _and_ a pragmatic requirement because "mv ~/bigtree ." can<br>
always create an arbitrarily deep path and then you gotta be able to get rid of it.<br>
<br>
While I'm using openat() for everything, I still hit filehandle exhaustion<br>
having too many dirfd open simultaneously. But those filehandles are only valid<br>
during the lifetime of the callback function anyway, so what I was gonna do was<br>
(at least beyond some depth threshold) keep the current and parent open, and<br>
then when it would cd .. out of the child and reopen(".") it would re-stat it to<br>
compare the cached stat info in the dirtree struct to make sure that parent<br>
directory's dev+inode pair hadn't changed, and just abort if it had because "mv<br>
subdir" during a traversal is pilot error and rm -rf or mv -a should definitely<br>
NOT cd .. out of a repotted deep directory and continue to merrily delete the<br>
parent directories in its new context...<br>
<br>
Anyway, I don't remember if I actually got around to implementing that, and<br>
haven't implemented a test for it in rm yet if I did. (I'd have to check the<br>
code and my todo lists. There's a whole "cleanup before 1.0" heap, but it comes<br>
after populating the roadmap and emptying pending.)<br>
<br>
> the reason i changed the test but not `make clean` was that i thought repeatedly<br>
> running `make test_foo` (without intervening calls to `make clean`) was more<br>
> likely to be the usual path. but maybe that's an argument for `make tests` and<br>
> `make test_foo` forcibly removing generated/testdir as if they were at least<br>
> that part of `make clean`?<br>
<br>
Possibly. I agree running tests without clean is a good thing to support, but<br>
"make clean sometimes doesn't" is a separate "we should fix that"...<br>
<br>
>     > Also, macOS seems to disallow +s in /tmp (but not otherwise), so<br>
>     > allow those tests to be skipped. This is why I was seeing macOS<br>
>     > test failures locally (because I pretty much always work on toybox<br>
>     > in /tmp) that we weren't seeing on the github CI runs (which<br>
>     > presumably don't run in /tmp).<br>
>     ><br>
>     > With this, all the tests are passing locally for me on macOS again.<br>
>     Needing to repeat skipnot before each line is awkward, lemme stare at it this<br>
>     evening...<br>
><br>
> i started with a bash `if` but decided i preferred your style of<br>
> explicitly listing every skipped test. (though i guess `if ... else <a message<br>
> about skipping all +s tests> fi` would be fine too.)<br>
<br>
I agree that the tests should say "skipped" rather than be skipped at the higher<br>
level. I'm saying my infrastructure probably needs a "skip until further notice"<br>
flag I can set... hang on, I have one, it's "$SKIP".<br>
<br>
Try now?<br></blockquote><div><br></div><div>git ToT + my locale patch (which i just resent) passes `make tests` on my work macbook. thanks!</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Rob<br>
</blockquote></div></div>