<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 23, 2022 at 11:48 PM 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 6/22/22 20:02, enh wrote:<br>
> On Wed, Jun 22, 2022 at 1:52 PM Rob Landley <<a href="mailto:rob@landley.net" target="_blank">rob@landley.net</a><br>
> <mailto:<a href="mailto:rob@landley.net" target="_blank">rob@landley.net</a>>> wrote:<br>
<br>
The problem with the mac tar test is even though it's easy enough to find what<br>
/etc/passwd calls UID 0:<br>
<br>
ROOT="$(sed -n '/[^:]*:[^:]*:0:/s/:.*//p' /etc/passwd)"<br>
<br>
That doesn't change the fact it'll be putting a different string into the<br>
tarball, with different sha1sums. Um. (I was using "root" as the one known<br>
constant account that didn't vary across distros. Possibly I need a way to tell<br>
it to use an alternate /etc/passwd file to lookup usernames. This is why I've<br>
been poking at mkroot, but making that work on a mac is just... ow.)<br></blockquote><div><br></div><div>note that it's /etc/*group* that's weird, not *passwd*. uid 0 is root, but group 0 is wheel. (i think that's true of all bsds?)</div><div><br></div><div>it actually looks like gid 0 is one of the few low gids that differs?</div><div><br></div><div>here's macos' first few gids:</div><div><br></div><div>nobody:*:-2:<br>nogroup:*:-1:<br>wheel:*:0:root<br>daemon:*:1:root<br>kmem:*:2:root<br>sys:*:3:root<br>tty:*:4:root<br></div><div><br></div><div>most of those are the same on linux.</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">
> On 6/20/22 21:32, enh via Toybox wrote:<br>
> > Specifically we were ending up with 2048 blocks allocated, and that --<br>
> > not the stat(1) behavior -- was the reason why this test was failing<br>
> > on macOS.<br>
> <br>
> Yay, I got thunderbird sending email through gmail again! (The version upgrade<br>
> changed the authentication type in the smtp server settings, but I could still<br>
> set it BACK...)<br>
> <br>
> I wanted a partially sparse file there, which truncate was preserving the<br>
> contents of. <br>
> <br>
> i must be missing something ... why is it _partially_ sparse?<br>
<br>
Because truncate should be able to extend an existing file sparsely without<br>
damaging the existing contents, but I see that the existing test wasn't doing<br>
what I thought it was doing...<br>
<br>
So hang on, if we made a file completely sparse in 3 segments, how many blocks<br>
does MacOS think it's allocated? Can I dig this out of the macos test log on github?<br>
<br>
<a href="https://github.com/landley/toybox/runs/7008521598?check_suite_focus=true" rel="noreferrer" target="_blank">https://github.com/landley/toybox/runs/7008521598?check_suite_focus=true</a><br>
<br>
scripts/test.sh<br>
scripts/runtest.sh: line 223: syntax error near unexpected token `;'<br>
scripts/runtest.sh: line 223: ` R) LEN=0; B=1; ;&'<br>
<br>
It _starts_ with a syntax error, and THEN proceeds to run the tests. I don't<br>
understand what it's doing here?<br></blockquote><div><br></div><div>(that's similar to what you see on Android with mksh at the moment --- there's some error but apparently it's harmless because the tests run anyway.)</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">
Scroll, scroll, scroll through the test results. VERBOSE=allnopass is probably<br>
your friend here...<br>
<br>
No it does not. And I don't have a mac to try this on. Hmmm...<br></blockquote><div><br></div><div>happy to run commands if you send me them.</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">
> There's %b and %B which is block size and size per block, and bash<br>
> can do:<br>
> <br>
> $ x=1+3; echo $((x))<br>
> 4<br>
> <br>
> So what I should probably do is:<br>
> <br>
> X=$(stat -c %B); [ $(($(stat -c %b freep)*X)) -le $((12345+X)) ]]<br>
<br>
Except toybox --help stat says "%b Size/512" so the units SHOULD be 512. It's<br>
never NOT 512 in Linux, and I remember a certain amount of digging to confirm<br>
this at the time? Hmmm. (Is the "right fix" to get the macos build to behave<br>
like the linux build?)<br>
<br>
> The problem is, you're not using bash or toysh for these tests, you're using a<br>
> shell of unknown capabilities. Can the macos and android shells do that?<br>
> <br>
> macos _is_ bash, it's just 3.2.57 from 2007, for exactly the reason you'd assume.<br>
<br>
They swapped to zsh three years ago:<br>
<br>
<a href="https://www.theverge.com/2019/6/4/18651872/apple-macos-catalina-zsh-bash-shell-replacement-features" rel="noreferrer" target="_blank">https://www.theverge.com/2019/6/4/18651872/apple-macos-catalina-zsh-bash-shell-replacement-features</a></blockquote><div><br></div><div>oh, yeah, good point. my reaction to that was similar to your reaction to dash. _i'll_ be using bash on macos until they remove it.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
That said I THINK all this $((math)) stuff I've been proposing is posix? So it<br>
should work...?<br></blockquote><div><br></div><div>yeah, certainly your </div><div><br></div><div>x=1+3; echo $((x))<br></div><div><br></div><div>example works the same on both zsh and old bash (printing 4) on this mac.</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">
> android is mksh, which is available as a debian package; i often do "android"<br>
> shell testing that way for convenience :-)<br>
> <br>
> if you send me a patch i can test it for you ... but feel free to just commit<br>
> "the right thing" and we can work from there!<br>
<br>
I'm no longer convinced I know what the right thing is here. Possibly the<br>
"delete and recreate" workaround is best, but I have no idea WHY it works...<br>
<br>
I'm tempted to borrow my wife's mac for a bit, but I have no idea how to set up<br>
a development environment on a mac. The first google hit is<br>
<a href="https://sourabhbajaj.com/mac-setup/Xcode/" rel="noreferrer" target="_blank">https://sourabhbajaj.com/mac-setup/Xcode/</a> which looks... more elaborate than I<br>
want to do on a borrowed machine.<br></blockquote><div><br></div><div>iirc it's a bit simpler than that (if you don't have some company policy that says you can only install binaries from their servers) --- you just run "make" and it pops up a window saying "you want to install all that shit?" and you say "it's a unix system; i know this", bish bash bosh, job done.</div><div><br></div><div>or, like i say, commit something that works on linux and i'll be your test monkey.</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>