<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 22, 2022 at 1:52 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/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. </blockquote><div><br></div><div>i must be missing something ... why is it _partially_ sparse?</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>
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></blockquote><div><br></div><div>macos _is_ bash, it's just 3.2.57 from 2007, for exactly the reason you'd assume.</div><div><br></div><div>android is mksh, which is available as a debian package; i often do "android" shell testing that way for convenience :-)</div><div><br></div><div>if you send me a patch i can test it for you ... but feel free to just commit "the right thing" and we can work from there!</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>
<br>
P>S. Possibly I should use expr instead? The main reason I hadn't promoted expr<br>
yet, modulo the historical priority issues and that posix bugfix resulting from<br>
me reporting that their html conversion was dropping information about priority<br>
grouping, was that I wanted to see if expr could use the same plumbing as<br>
$((math)) in the shell. And now that I've got the shell math plumbing<br>
finished-ish, the answer is that I could probably write a NEW expr using that<br>
plumbing, but the existing one very much not. I dislike the parallel string/int<br>
plumbing in the current expr, and the TWO different enums where we tag a<br>
structure in order to marshall data to ourselves... Hmmm...<br>
</blockquote></div></div>