[Toybox] [PATCH] top: don't report GiB sizes in KiB.

Rob Landley rob at landley.net
Tue Sep 8 01:05:28 PDT 2020

On 9/8/20 12:20 AM, Jarno Mäkipää wrote:
> Im sorry didint want to cause argument.

I was happy with the big long strings of numbers we had to start with. I just
don't consider "make the strings shorter with no other change/reason" to be a fix.

> But atleast 1/3 of world teach
> to use comma as decimal separator (most old french colonies etc...) so
> someone else might have got confused and report this sooner or later.

Indeed. If libc grows support for distinguishing these, toybox should use it.
I'd like to put the code in speculatively so it's not my problem it's wrong. :)

I haven't done it _yet_ because I'm trying to teach toysh how to properly parse
case statements. I got the all-on-one-line version working but when you start
throwing newlines in there the parser gets confused at the variable granularity
of input and when to request line continuations. The fundamental problem is case
statements have unbalanced ) in them which the generic parser barfs on so I have
to special case that:

  case i



  echo hello



is equivalent to:

  case i in i) echo hello

But for SOME reason I can replace THAT newline with a ; but can't put a ;
anywhere before the ) BECAUSE REASONS. (And yes the terminating ;; was optional
in the last position. And the other variants like ;& are considered equivalent
there rather than errors. And yes I still need to catch
"case i in i) echo hello | esac" or && but & is fine, you can put a & after a
break and bash takes it because reasons...

Oh, and I _probably_ fly back to Japan around the 19th for work. Not sure yet,
still filing paperwork.

Anyway: distracted. :)

>>> SI system uses spaces as thousands separator, comma and period both
>>> being valid decimal separator.
>>> 123 456.789 or 123 456,789
>> Ok, I'll bite: which countries teach SI to their kids in primary school?
> Eh? not sure are you joking.

Honest ignorance. You were saying you use period, now you're saying you use
space. This is not my area of expertise. I'm happy to ask libc.

>> A proper fix would be a localeconv() in libc that DOESN'T return constant stub
>> info, which is out of scope for toybox. (And is as much an ADB thing as a bionic
>> thing since android seems to be using adb instead of ssh, so that would have to
>> marshall the locale environment variables from the host into the target. But I
>> often "wait for somebody to complain", you complained, and therefore I want to
>> fix it PROPERLY.)
> Yeah I agree fixing it properly would move the problem out of toybox
> context. Im sure we dont want to be arguing what is comma used for.

It's an aesthetic issue, therefore there is endless bikeshedding which cannot be
terminated by normal open source development practices other than A) maintainer
fiat, B) appeal to some standards body that puts out "an ISO standard cup of
tea" and ISO standard peanut butter. Yes, both exist:


And yes there's reasons for it:


Everything is domain expertise and it's all fractal:


And often you have to learn enough about something to determine you don't have
to care and can chuck it all in the bin.


This is sometimes called the "grandma's roasting pan fallacy":


The whole POINT of busybox and toybox was to ask "yes, but do we need to do
that" to make things smaller and simpler. In this case it sounds like yes, we
need to do that. The options are Don't Go There (Elliott says long strings of
numbers are unhappy-making), feed everybody commas (makes 1/3 the population of
the planet unhappy), or fish it out of libc's internationalizatoin setting
(which is small in this instance, at least nominally standardized, and I can
fall back to #2 if libc doesn't implement it).

(People will then bitch about date formats and I will probably ignore them
because they didn't complain about it when it went in an the fix ISN'T small in
that case.)

>> In the meantime, I can add a call to localeconv() that would use "," if that
>> returns "" which means right now it would be a NOP but then it's not my fault
>> it's getting it wrong. And I can test against glibc which does have an
>> overengineered version of this in it. Way back when uClibc had a much compressed
>> format for the localeconv data, but didn't have a database of countries and thus
>> copied its data from glibc, which it couldn't distribute for licensing reasons:
>>   https://lists.uclibc.org/pipermail/uclibc/2015-June/049000.html
>> Rob
>> P.S. I ranted about this sort of aesthetic issue being something the open source
>> development model can't deal with 10 years ago, almost to the day:
>>   https://landley.net/notes-2010.html#13-08-2010
>> And included it in my 2013 talk:
>>   https://www.youtube.com/watch?v=SGmtP5Lg_t0#t=11m30s
> I think its not only Open Source problem, if you look how horrible
> some user interfaces grow into, after company making them grows.

Any time you hand the development of an aesthetic issue over to a committee, it
doesn't matter if it's churning out Licensed Property novelizations or
institutional decor in corporate office buildings or movies buried in "notes".
Bureaucracies can outsource it to One Person With a Coherent Idea (assuming they
can tell poseurs trying to milk big clients for money from people who are
actually good at it), but anything you "workshop" becomes gruel.

There's an hour-long talk I could do on this but there's SO much backstory you
need because "what do MEAN a giant mechanical spider" requires knowing about
https://www.cbr.com/the-mirrormask-interviews-neil-gaiman-dave-mckean/ and
splicing together the anecdotes to properly explain stuff is a whole Thing...

And to be honest John Rogers (creator of Leverage) probably already did that
talk. (As did Neil Gaiman, Elizabeth Bear, Cory Doctorow...)

> -Jarno


P.S. I'm not the one who introduced human_readable(), but if we're GONNA do it,
some combination of https://www.schlockmercenary.com/2006-07-13 and
probably applies. Now I just need to figure out what "doing it right" actually IS...

More information about the Toybox mailing list