144 points · by ducktective · 5y ago · 91 comments
Anyway, for users trying to do stuff with these utils, the available paths seem to be either finding StackOverflow answers from others who already messed with their own systems and survived, or being the first to do the trial-and-error.
Regardless, I agree that there should be a proper man page with more detail.
"Anyway, for users ..."
Ah, thats me. I am a user. I personally love terse and cryptic, i.e., minimising the number of keys I have to press. IME, multicall binaries like the OP presume some pre-existing knowledge of how to use the utilities they contain. It seems nonsensical to complain about missing documentation given the purpose of a multicall binary is to conserve space.
With BSD, the utilities in crunched binaries are generally the same ones, i.e., use the same source code, as in one in the userland. With GNU busybox, they are not, and one needs to read the source code to understand the differences.
Even if I can figure out how to use a program from reading documentation I still look at the source code before using it for the first time.
My `bc` is in toybox, but I have put extensive effort into documenting it. [1] I have even documented it for future maintainers. [2]
[1]: https://git.yzena.com/gavin/bc/src/branch/master/manuals/bc/...
[2]: https://git.yzena.com/gavin/bc/src/branch/master/manuals/dev...
Father calls his small son to him, pours a shot of vodka and tells him to drink it. The son drinks, then makes a face and says in repulse: “Eurgh, it's disgusting!”
The man replies: “Yeah, you probably thought your dad drinks honey, did you?”
In short: "Programs are meant to be read by humans, and only incidentally for computers to execute."
fuck you. it's a myth perpetrated by lazy programmers, who can't be bothered to spend an hour or two writing a comprehensible usage manual, while otherwise EVERY USER IS GUARANTEED to spend MORE just figuring out how to BEGIN using his crap. It's only forgivable for the simplest of self-explanatory /API/ calls, but /nothing/ in userspace.
If you wouldn't mind reviewing https://news.ycombinator.com/newsguidelines.html and taking the intended spirit of the site more to heart, we'd be grateful. In particular, we don't want flamewars, and you've unfortunately already posted quite a few flamewar comments. Can you stick to thoughtful, curious comments instead? That's the kind of conversation we're trying for here. Note that that includes being respectful to whomever you're talking with, regardless of how wrong they are or you feel they are.
> The toybox build produces a multicall binary, a "swiss-army-knife" program that acts differently depending on the name it was called by (cp, mv, cat...). Installing toybox adds symlinks for each command name to the $PATH.
> The special "toybox" command treats its first argument as the command to run. With no arguments, it lists available commands. This allows you to use toybox without installing it, and is the only command that can have an arbitrary suffix (hence "toybox-armv5l").
Edit: found it elsewhere in the thread. It's rewritten because they didn't like GPL for religious reasons. (Busybox is a completely separate binary from the rest of the system so there is no reason not to ship GPL-licensed software that I can see, but yeah if you've been bitten by making a closed source work derived from GPL once, I guess you don't want to try it again and Android has a lot of vendors with closed source components.)
This is one of the reasons why Google Android, and probably many others, are using Toybox for their userland. Because it's distributed under a BSD license.
---
Why did I switch from busybox to toybox?
I left busybox due to an argument over GPLv3.
- https://lwn.net/Articles/202106/ (busy busy busybox)
Took all the fun out of it (reminded me of "SCO Disease") Did toybox as a hobby for a bit, no real expectation anybody use it. Even came back to busybox for a while, on and off, circa 2008-2011 sent toybox patch to busybox, fixed their vi, nbd-client...
- http://lists.busybox.net/pipermail/busybox/2008-October/0673...
- http://lists.busybox.net/pipermail/busybox/2010-September/07...
- https://landley.net/notes-2015.html#30-07-2015
---
- https://youtu.be/MkJkyMuBm3g?t=1525 (at 25:25)
Also I think it's worth to listen the first 10 minutes as an intro, and brief about licensing from 5 minutes forward. Where he explains how BusyBox's licensing was then used by other people as "beating tool" to get hardware specs.
-- http://landley.net/toybox/about.html
Possibly also interesting: Toyboy vs. Busybox https://www.youtube.com/watch?v=MkJkyMuBm3g#t=1m18s
Edit: A list showing the change with what tools are supplied by each box in each version: https://android.googlesource.com/platform/system/core/+/mast...
I hate the whole idea of intellectual property, so the less time I (and everyone, really) have to spend caring about it, the better.
MIT and BSD licenses allow everyone to care as little as legally possible about copyright, so in that regard any other choice is inferior.
And the "companies will be forced to give back to the project" argument never made sense to me.
Enter GPLv3 which wasn't even compatible with the unmodified GPLv2 and to Landley this made it no longer a universal receiver. Couple that with his disagreement over using the GPL in BusyBox to leverage source code from vendors, he created ToyBox and the 0BSD license. He sees the 0BSD license as a universal donor since GPL is no longer a universal receiver.
I mean for now there is a fashion among contributors to keep software open-source, but they don't like it as obligation. (Where "contributors" include ICs, but are really mainly businesses these days.) And the notion of "universality" is in fact more about forsaking my right to require the software to remain free. Why would I need that again? It seems that when thinking about progress/ROI open-source turned out to work very well as a fashion, what's wrong with it being a legal obligation then?
List of variants of BSD: https://fedoraproject.org/wiki/Licensing:BSD?rd=Licensing/BS...
Similarly, Apple has a policy against shipping GPLv3 code. When bash upgraded to GPLv3 from GPLv2 ~10 years ago, Apple stopped upgrading it, and then eventually migrated to zsh, which is MIT licensed.
The issue is that GPL is a "viral" license, which hasn't been tested all that much in court, but they're erring on the safe side. They don't want to mix their proprietary code with GPL code.
Google LLC v. Oracle America, Inc.
The code in question was Java code, which has been licensed under (among possibly other licenses) the GPL. The terms of the GPL has not been an issue in the case, but GPL's "virality" AFAIK is premised somewhat on things like API copyrightability.
https://lore.kernel.org/all/20031206211900.GA9034@thunk.org/...
Quoting from Theodore Ts'o in 2003:
But that aside, does the Open Source community really want to push for the legal principal that just because you write an independent program which uses a particular API, the license infects across the interface? That's essentially interface copyrights, and if say the FSF were to file an amicus curiae brief support that particular legal principle in an kernel modules case, it's worthwhile to think about how Microsoft and Apple could use that case law to f*ck us over very badly.
So one motivation for creating toybox was apparently that he wanted it as a busybox alternative for users afraid of lawsuits.
Bottom line is if you're shipping software with your phone that you didn't write, maybe spend the really minimal amount of time to make sure you're in compliance with the license, especially when the license (GPL) makes no onerous demands at all except you might need to put up an apache server somewhere with the source on it.
The last update was several years ago because Rob wanted to maintain the version in toybox himself. It has not gotten much love since.
Source: I am the author of the `bc` in toybox. My current version [1] is much faster and has more math libraries and extensions. Even Android uses my current version rather than the version in toybox.
Edit: mistakenly said that toybox has my `dc`. It does not. Busybox does, and I mixed them up. I've corrected the above.
I have a (very) educated guess, but it's still only a guess.
I think there were two reasons.
The first is historical practice. POSIX themselves say that they don't codify new standards. Instead, they codify existing practice as standards. In practical terms, this means that they look at what all implementations that they care about do, figure out what is common among them, and codify that as a standard.
As far as I can tell, at the time that POSIX was first codified, there was at least one `bc` implementation that only accepted single letter names. So that's what they codified.
Some evidence for this reason: in the Rationale section of the `bc` standard [1], they mention historical practice and implementations several times.
(As an aside, the reason that that implementation only accepted single letter names is because it was a compiler for `dc`, and `dc` only accepts single letter names because of its reverse polish notation and "one letter per command" design.)
The second reason, while related to the fact that historically, `bc` was a frontend to `dc`, is slightly different: it's easier to implement that way.
If you look at the original source of the original Robert Morris and Lorinda Cherry `bc` (which I have because I'm a nerd), its parser only looked for the second letter of each keyword. They could do that because all other identifiers would be single letters. It worked, and they also probably wanted to spend little time on it since most of the users would be programmers like themselves who could deal with such limitations easily, though that is an assumption on my part. (Someday I would like to talk to Morris and Cherry about it, as well as Philip Nelson, the author of the GNU `bc`.)
By the way, the original Morris and Cherry implementation was the implementation in use at the time of codifying POSIX that only allowed single letter names. Its direct descendant is still in use today as the `bc` for the Plan 9 operating system.
So that's my guess. Take it with a grain of salt.
Now, suppose I want to write a POSIX shell script that does trigonometric calculations. Should I actually use `bc`? Is there a "translator" that reads `GNU bc` or your `bc` for example, and converts it into POSIX-compliant bc? (meaning converting the symbols to one letter in a way that does not produce conflict, declaring all used variables in a function in the first line (auto), etc)
So he does not want my updates.
https://youtu.be/MkJkyMuBm3g?t=744 about 12 minute mark, he mentions how people used BusyBox in US army because they wanted to audit all the code, and this was his realization.
I think it's a worthy goal. But surely if bc is missing some useful features there is probably no harm having multiple implementations.
Even busybox in many builds does not come with bc which is a posix requirement.
> The toybox build produces a multicall binary, a "swiss-army-knife" program that acts differently depending on the name it was called by (cp, mv, cat...). Installing toybox adds symlinks for each command name to the $PATH.
> The special "toybox" command treats its first argument as the command to run. With no arguments, it lists available commands. This allows you to use toybox without installing it, and is the only command that can have an arbitrary suffix (hence "toybox-armv5l").