On Wed, Jun 22, 2022 at 1:52 PM Rob Landley <[email protected]> wrote:
> On 6/20/22 21:32, enh via Toybox wrote: > > Specifically we were ending up with 2048 blocks allocated, and that -- > > not the stat(1) behavior -- was the reason why this test was failing > > on macOS. > > Yay, I got thunderbird sending email through gmail again! (The version > upgrade > changed the authentication type in the smtp server settings, but I could > still > set it BACK...) > > I wanted a partially sparse file there, which truncate was preserving the > contents of. i must be missing something ... why is it _partially_ sparse? > There's %b and %B which is block size and size per block, and bash > can do: > > $ x=1+3; echo $((x)) > 4 > > So what I should probably do is: > > X=$(stat -c %B); [ $(($(stat -c %b freep)*X)) -le $((12345+X)) ]] > > The problem is, you're not using bash or toysh for these tests, you're > using a > shell of unknown capabilities. Can the macos and android shells do that? > macos _is_ bash, it's just 3.2.57 from 2007, for exactly the reason you'd assume. android is mksh, which is available as a debian package; i often do "android" shell testing that way for convenience :-) 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! > Rob > > P>S. Possibly I should use expr instead? The main reason I hadn't promoted > expr > yet, modulo the historical priority issues and that posix bugfix resulting > from > me reporting that their html conversion was dropping information about > priority > grouping, was that I wanted to see if expr could use the same plumbing as > $((math)) in the shell. And now that I've got the shell math plumbing > finished-ish, the answer is that I could probably write a NEW expr using > that > plumbing, but the existing one very much not. I dislike the parallel > string/int > plumbing in the current expr, and the TWO different enums where we tag a > structure in order to marshall data to ourselves... Hmmm... >
_______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
