[Toybox] [PATCH] Fix truncate.test for macOS.
Rob Landley
rob at landley.net
Wed Jun 22 13:58:03 PDT 2022
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. 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?
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...
More information about the Toybox
mailing list