[Toybox] --version for all commands?

Rob Landley rob at landley.net
Fri Sep 30 01:17:00 PDT 2016


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

> 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...

> 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.

Rob



More information about the Toybox mailing list