[Toybox] I aten't dead.

enh enh at google.com
Tue Feb 24 13:30:20 PST 2015


On Tue, Feb 24, 2015 at 11:46 AM, Rob Landley <rob at landley.net> wrote:
> Sorry for the radio silence, $DAYJOB's been eating the majority of my
> programming time and what's left has gone to Aboriginal Linux recently,
> because I made a largeish design change over there (putting the base
> root filesystem in initmpfs and merging the native-compiler at runtime
> instead of compile time), and the aboriginal linux release soft-blocks
> the toybox release because I use "built aboriginal and then built linux
> from scratch under it" as my main toybox regression-smoketest.
>
> Last night's I hit a fun bug in toybox "stat" where it doesn't remotely
> work on arm. (Works fine on x86 host, but 3.18 kernel built against
> uClibc on armv5l: the -f numbers are way off, it thinks the blocksize of
> ext2fs is 32 bytes.)

seems fine on armv7 3.10 with bionic. oh, specifically the -f output.
yeah, that looks wrong :-)

a lot of those fields are actually 64-bit, so you need an extra 'l' on LP32:

diff --git a/toys/other/stat.c b/toys/other/stat.c
index d603316..a96c1de 100644
--- a/toys/other/stat.c
+++ b/toys/other/stat.c
@@ -106,11 +106,11 @@ static void print_stat(char type)
 static void print_statfs(char type) {
   struct statfs *statfs = (struct statfs *)&TT.stat;

-  if (type == 'a') xprintf("%lu", statfs->f_bavail);
-  else if (type == 'b') xprintf("%lu", statfs->f_blocks);
-  else if (type == 'c') xprintf("%lu", statfs->f_files);
-  else if (type == 'd') xprintf("%lu", statfs->f_ffree);
-  else if (type == 'f') xprintf("%lu", statfs->f_bfree);
+  if (type == 'a') xprintf("%llu", statfs->f_bavail);
+  else if (type == 'b') xprintf("%llu", statfs->f_blocks);
+  else if (type == 'c') xprintf("%llu", statfs->f_files);
+  else if (type == 'd') xprintf("%llu", statfs->f_ffree);
+  else if (type == 'f') xprintf("%llu", statfs->f_bfree);
   else if (type == 'l') xprintf("%ld", statfs->f_namelen);
   else if (type == 't') xprintf("%lx", statfs->f_type);
   else if (type == 'i')

> (I hit this because the "do I need to copy the filesystem into a chroot
> under /home before building LFS" test _used_ to be "is / read-only", and
> now it's a tmpfs with 64 megs of ram in it so it's writeable but not
> _big_ enough. And posix "df" doesn't seem to have an easily scriptable
> way to get the current size of a filesystem without having to chop it
> out with awk, which is why I'm using stat.)
>
> I wrote some of it up at http://landley.net/notes.html which I'm trying
> to keep more updated, but writing status updates _there_ means I'm
> posting less of them _here_...
>
> Sigh. I should do a "toybox weekly news" ala
> http://landley.net/qemu/2008.html (for a value of "should" that means
> $DAYJOB still comes first hours-wise.)
>
> Speaking of which, back to kernel code...
>
> Rob
>
> P.S. Dreamhost's web archive seems to have started up again, by
> discarding all the pending data and thus putting another half-month hole
> in the archives. I mentioned that on http://landley.net/toybox but
> again, didn't mention it here...
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net

 1424813420.0


More information about the Toybox mailing list