[Toybox] --version for all commands?

enh enh at google.com
Fri Sep 30 13:32:56 PDT 2016


On Fri, Sep 30, 2016 at 1:17 AM, Rob Landley <rob at landley.net> wrote:
> On 09/29/2016 06:41 PM, enh wrote:
>> is there a reason why --help works for all commands,
>
> Not all, see commit e98089ab9a4b.
>
> That's part of the reason I've been reluctant to add more globally
> recognized --options (and made the one we have disablable in kconfig),
> but if there's a good reason to...
>
>> but --version only works for toybox directly?
>
> Because --help has unique data for each command, but --version doesn't?
> (If it's a toybox command, it's the version _of_ toybox that counts.
> Other commands being symlinks to the toybox binary lets you know it's
> toybox.)
>
> Way back when in busybox-land, a couple developers were very proprietary
> about "their" commands, and I was going "it's one big package". Having a
> separate version for individual commands (each with its own numbering
> scheme) was SILLY. There was also the "some tools are separate projects
> AND part of busybox" ala the udhcp stuff... it was a mess. I cleaned it
> up with extreme prejudice. That's never been an issue in toybox, but I
> hadn't wanted to open that can of worms either.
>
> Also, there's this:
>
>   ./toybox sed --version
>
> Because autoconf is grepping for "GNU sed version xxx" and making sure
> the xxx is high enough, otherwise it does really STUPID workarounds that
> were last tested in 1991 and break stuff.
>
>   http://lists.busybox.net/pipermail/busybox/2004-January/044644.html

(you could maybe do the web browser thing of "i'm actually SomeBrowser
x.y.z (but i'm similar to MS Browser you've hard-coded)"?)

>> somewhat related, is there a reason we don't advertise "toybox" in the
>> --version output?
>
> It didn't because --version was an argument to the toybox command?
>
> Does cat --version say coreutils? Huh, apparently so...

yeah, i think this is where the expectation is coming from. you and i
think "toybox" and know that the binary that everything's a symlink to
has options of its own, but it turns out that not all users do.

>> this came up in the context of folks trying to work out what "ps"
>> they're talking to. i've been suggesting the idiom of "toy
>> --some-option-you-want-that-toolbox-did-not-have || toy
>> --legacy-option", particularly "ps -e || ps" to get the -A behavior
>> even if you have a tty.
>>
>> but people find it surprising that (say) ps --version doesn't work,
>> and i suspect that if it did work, they'd find it surprising that it
>> doesn't say "toybox" anywhere in the output.
>
> If you feel strongly about it we can change it, but the existing logic
> was that the ps executable is a symlink to toybox, and toybox has --version.

well, *i'm* fine :-)

i don't have a strong use case, but wanted to pass along "not all your
users know the symlink thing is even a thing" and "not all your users
know that the toybox binary itself has options" (plus, possibly, "not
all toybox users know they're toybox users"). specifically, on a bug
report someone mentioned that they couldn't give a version for ps
because "ps --version" doesn't work. i suspect others will stop there
too.

it's only come up once so far, though, so if you want to wait and see
i'll let you know if this keeps cropping up.

(on the "it was good enough for busybox" front: is there an OS where
busybox is the default? or are folks with busybox implementing their
/bin all cognizant of the fact because they had to manually do that to
themselves in the first place?)

> Rob
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net



-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.


More information about the Toybox mailing list