<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 22, 2021 at 5:39 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 2/22/21 4:27 PM, enh via Toybox wrote:<br>
> My patch to fix df behavior on macOS broke the stat build on macOS.<br>
> <br>
> First off, we had %s and %S the wrong way round compared to coreutils,<br>
> though since Linux always seems to use the same value for both,<br>
> no-one will ever have noticed.<br>
> <br>
> Annoyingly, Linux and macOS disagree about what statfs::f_bsize<br>
> means, and whether statfs::f_iosize and statfs::f_frsize exist (each<br>
> has one or the other, depending on what f_bsize *doesn't* mean to<br>
> them). This mess is presumably why statvfs exists.<br>
<br>
Oh that's ugly.<br>
<br>
> Unfortunately, statvfs on macOS at least doesn't contain the file<br>
> system type information.  So we either need to do *both* statfs()<br>
> and statvfs() for macOS, or we need to take into account the different<br>
> fields.<br>
> <br>
> This patch adds an #ifdef outside of portability.h because I wasn't<br>
> sure we actually wanted to add statfs_best_transfer_size() and<br>
> statfs_real_block_size() functions to lib for this. But that's an<br>
> easy cleanup if desired.<br>
<br>
I moved it to static inline wrappers in portability.h, let me know if I typoed<br>
something in the apple part I can't test.<br></blockquote><div><br></div><div>github's nice green check mark shows that it _builds_ at least, but, yes, i've tried with your patch and both stat and df lgtm on macOS now. (i've sent a patch to add df to the macOS default configuration.)</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>