<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Tue, Jan 7, 2025 at 10:09 AM Rob Landley <<a href="mailto:rob@landley.net">rob@landley.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 1/6/25 19:21, scsijon wrote:<br>
> Please don't yell at the messenger.<br>
> <br>
> I was asked if there is a list online showing the differences between <br>
> Toybox's packages (?toys) and Busybox's since I use it.<br>
<br>
I gave a busybox vs toybox talk in 2019 (linked from the about page), <br>
but that was more history and 10k foot view and only went side by side <br>
over over one actual command to give a flavor of the thing.<br>
<br>
> From a little <br>
> more messaging back at them. It seems that what they want is a <br>
> comparison list for the commands, and not further details (at least at <br>
> this point). I thought this would be a quick lookup and link, but I <br>
> can't see / find one anywhere, so before I spend time and create one <br>
> from scratch, has anyone already created it, and can I either have a <br>
> copy or a link I can use please?<br>
<br>
There's some stuff in roadmap.html but both busybox and toybox are <br>
moving targets, and it's mostly a question of "what were you trying to <br>
do" = what did you hit...<br>
<br>
I occasionally check busybox commands' --help output to see what options <br>
they support (to make sure I'm not missing anything obvious, or as <br>
arguing against implementing something if they never bothered), but <br>
haven't systematically tracked (let alone catalogued) the differences.<br>
<br>
Commands in toybox that aren't in busybox defconfig:<br>
<br>
$ diff -u <(toybox|tr ' ' '\n') <(busybox --list)|sed -n 's/^-//p'|xargs<br>
acpi base32 bash chattr chrt cksum comm count eject file flock fmt <br>
fstype fsync getconf gpiodetect gpiofind gpioget gpioinfo gpioset help <br>
hexedit host iconv inotifyd install iorenice iotop killall5 lsattr lspci <br>
lsusb makedevs mcookie memeater mix mountpoint nbd-client nbd-server <br>
netcat nice nohup oneit pgrep pkill pmap printenv prlimit pwdx pwgen <br>
readahead readelf rfkill rtcwake setfattr sha224sum sha384sum sntp split <br>
su toysh tsort tunctl uclampset ulimit unicode uuidgen vmstat<br>
<br>
Commands in busybox that aren't (yet) in toybox.<br>
<br>
$ diff -u <(toybox|tr ' ' '\n') <(busybox --list)|sed -n 's/^+//p'|xargs<br>
[[ acpid adjtimex ar arp arping ash awk bc brctl bzip2 cttyhack dc <br>
depmod diff dumpkmap dumpleases expr fatattr fdisk findfs fstrim getty <br>
gzip hexdump hostid ifdown ifup init ip ipcalc ipneigh klogd last less <br>
linux64 linuxrc loadfont loadkmap logread lsscsi lzcat lzma lzop mdev <br>
mim mkdosfs mke2fs modprobe more mt nameif nologin nslookup nuke rdate <br>
resume rpm rpm2cpio run-init run-parts setkeycodes setpriv ssl_client <br>
start-stop-daemon stty svc svok syslogd telnet tftp tr traceroute <br>
traceroute6 ubirename udhcpc udhcpd uevent uncompress unexpand unlzma <br>
unxz unzip vi xz xzcat<br>
<br>
Several of which are in pending and/or the roadmap, and I guess maybe <br>
findfs is worth adding? And/or fstrim?<br>
<br>
Why would you install a _symlink_ for [[ isn't the difference from [ is <br>
to interact with shell internal state...? How would that work?<br>
<br>
The toybox faq has an entry on why we don't have "cttyhack". (Even oneit <br>
is kinda obsolete these days.)<br>
<br>
I am unclear what "linux64" would DO: you _start_ from 64 bits. Note <br>
that this is NOT about running 32 bit vs 64 bit binaries, the kernel's <br>
ELF loader does that during exec, this is about a specific hack to make <br>
"uname -m" lie about the architecture to lie to autoconf, because <br>
listening to the compiler macros:<br>
<br>
$ :|cc -E -dM - | grep 86_<br>
#define __x86_64 1<br>
#define __x86_64__ 1<br>
$ :|i686-cc -E -dM - | grep 86_<br>
#define __i686__ 1<br>
#define __i386__ 1<br>
<br>
Is WAY too complicated for gnu/gnu which needs to ask ALL THE WRONG <br>
QUESTIONS and then use the results inappropriately. ("Autoconf is <br>
useless" may be sung to "every sperm is sacred".)<br>
<br>
"linuxrc" was the magic init name initial ramdisks used in the 1.x <br>
kernels back before initramfs was invented: mkroot uses an /init shell <br>
script and toybox can follow symlink chains to figure out what name a <br>
command actually has even if you did want to "ln -s /sbin/init /initrd", <br>
and I think the kernel changed the plumbing so even initrd calls /init <br>
now? (And there's a rdinit= kernel command line argument...)<br>
<br>
dumpkmap/loadkmap is sort of conceptually terrible (it's a binary dump <br>
of state subject to version skew, where you basically copy state from a <br>
"real" system that actually sets it up properly). I vaguely recall <br>
"loadfont" and "setfont" were something similar (for remapping the font <br>
in text mode console on VGA cards, might work in framebuffer too? But <br>
the design was pre-unicode so don't ask me what it does _now_ or how its <br>
file format would have changed...) and note that both commands SET the <br>
font (no idea the difference between them), so where you get the font <br>
file FROM is... And "setkeycodes" is also for the text mode kernel <br>
consoles. (I mean, I could? But neither serial consoles nor xterm will <br>
care.)<br>
<br>
There's a hostid in toys/example because it's an obsolete command. A <br>
"globally unique 32 bit ID" on a planet with more than 4 billion <br>
computers ran into conceptual issues back around y2k.<br>
<br>
"mim" was the evil witch in disney's "sword in the stone" who turned <br>
into a purple dragon and was defeated with germ warfare, and in this <br>
case claims to be a "makefile-like" embedded shell script for no <br>
apparent reason: <a href="https://git.busybox.net/busybox/commit/?id=981b2eff814b" rel="noreferrer" target="_blank">https://git.busybox.net/busybox/commit/?id=981b2eff814b</a><br>
<br>
"mt" is short for "magnetic tape", which was not a common piece of <br>
hardware even back in 2006.<br>
<br>
"nameif" is, for some reason, a standalone version of ifconfig rename.<br>
<br>
"nologin" seems a bit like initrd, in that busybox can't follow symlinks <br>
to determine behavior so if you make a symlink to "false" busybox <br>
doesn't know what to do with it and toybox does? I guess?<br>
<br>
I have NO idea why a defconfig build of current busybox git is showing <br>
"nuke" in --list but saying applet not found for ./busybox --help nuke. <br>
The help text at the top of klibc-utils/nuke.c says:<br>
<br>
//config:config NUKE<br>
//config: bool "nuke (2.9 kb)"<br>
//config: default n # off by default: too "accidentally destructive"<br>
//config: help<br>
//config: Alias to "rm -rf".<br>
<br>
Did their plumbing get confused by having a comment after the default n <br>
maybe? No idea.<br>
<br>
Toybox implemented sntp (which is a receive-compatible subset of ntp) <br>
instead of rdate because the rfc 868 "time" protocol is FSCKING stupid, <br>
it gives a 32 bit value for seconds since 1900 (not 1970) meaning the <br>
unix epoch was over halfway through the 32 bit space it runs out in <br>
something like 2031? I pondered implementing it anyway because I vaguely <br>
recall it used to be built into qemu's virtual network stack, but if so <br>
they removed it a while back...<br>
<br>
I guess "setpriv" would be interesting to someone who actually uses <br>
selinux? Or no, is this capability bits? </blockquote><div><br></div><div>interestingly, it looks like "all of the above" --- it's a single command that lets you mess with ids, groups, environment, capabilities, selinux labels, etc... an interesting idea in theory, but this is the first i've ever heard of its existence.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I've had a hard time taking <br>
those seriously since:<br>
<br>
<a href="https://forums.grsecurity.net/viewtopic.php?f=7&t=2522" rel="noreferrer" target="_blank">https://forums.grsecurity.net/viewtopic.php?f=7&t=2522</a><br>
<br>
But I guess it's vaguely adjacent to "unshare"? (Which toybox already <br>
has. I've meant to do a "contain" command that set all that nonsense <br>
from one command line, so you can make a wrapper script to enter a <br>
container...)<br></blockquote><div><br></div><div>...and annoyingly, the one thing that setpriv is _missing_ is the unshare stuff :-(</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I would LOVE an "ssl_client" command, Denys implemented his own https <br>
stack! That's a solid month of work, at least. (And that's picking one <br>
algorithm at each layer.) For the moment we're stuck pulling in an ssl <br>
library for that stuff. Anything more is post-1.0 (and the big blocker <br>
for 1.0 is finishing up the shell, just got going on that again recently).<br>
<br>
Denys is a big fan of "runsv" and I've never quite seen the appeal.<br>
<br>
Does "ubirename" come up much? I've never encountered it, and nobody's <br>
asked. (UBI is an optional layer of flash plumbing, inserting a software <br>
block remapping layer for devices that don't do hardware block <br>
remapping. As far as I know its only consumer is ubifs ala <br>
<a href="https://docs.kernel.org/filesystems/ubifs.html" rel="noreferrer" target="_blank">https://docs.kernel.org/filesystems/ubifs.html</a> but for some reason "ubi" <br>
is a separate layer of plumbing ubifs depends on. You'd THINK it would <br>
let you mount ext2 and friends on top of flash with wear levelling, but <br>
no! It does not. Jazzhands!) Why does busybox have a "rename" command <br>
but not the corresponding "mkfs"? Your guess is as good as mine. I've <br>
only ever had to use ubifs once and it was a pain: jffs2, yaffs, and <br>
f2fs don't use ubi. Nor did logfs back when that was a thing.<br>
<br>
I guess "uevent" might be useful, the sketch I had for mdev here built <br>
the netlink plumbing in. Are there any uevents OTHER than mdev we should <br>
care about...? (Android ain't ever gonna use that, and the embedded <br>
systems I've been playing with don't hotplug much after startup, so...)<br>
<br>
Ah, "uncompress". But not "compress". Yes posix still has <br>
<a href="https://pubs.opengroup.org/onlinepubs/9799919799/utilities/compress.html" rel="noreferrer" target="_blank">https://pubs.opengroup.org/onlinepubs/9799919799/utilities/compress.html</a> <br>
but the actual compression TYPE was patented in the 1980s (the above <br>
page says 2 patents, issued 1984 and 1985 respectively) and EVERYBODY <br>
abandoned it for gzip because of the patent trolling, and by the time <br>
the patent expired (2005-ish I'd guess) compress was LONG dead. I have <br>
chosen not to implement it for the same reason I haven't got "arj" and <br>
"zoo".<br>
<br>
Huh, I thought I had "unexpand". (Wasn't there some horrible utf8 <br>
fontmetrics corner case? Hmmm, nope it's still in status.html on the <br>
posix list. Odd.)<br>
<br>
As for "unlzma": remember the recent discussion about the tar -Z patch <br>
for zstd? Which is not xz. Which is not lzma. Seriously, the 6.13-rc5 <br>
kernel's menuconfig has:<br>
<br>
[*] Support initial ramdisk/ramfs compressed using gzip<br>
[*] Support initial ramdisk/ramfs compressed using bzip2<br>
[*] Support initial ramdisk/ramfs compressed using LZMA<br>
[*] Support initial ramdisk/ramfs compressed using XZ<br>
[*] Support initial ramdisk/ramfs compressed using LZO<br>
[*] Support initial ramdisk/ramfs compressed using LZ4<br>
[*] Support initial ramdisk/ramfs compressed using ZSTD<br>
<br>
I've written gzip and bzip2 decompressors, have a public domain xz in <br>
pending (with a big todo list of commits to apply to it _and_ it needs a <br>
giant cleanup), and I honestly don't understand the difference between <br>
the other 4 on the list and xz. (It's the arj/zoo/pak days all over <br>
again. We only remember 'zip' from that period because it won but there <br>
were TONS. And zip itself had a bunch of algorithms before 2.0 gave us <br>
"deflate", I have an old button somewhere "unzip, expand, explode, what <br>
pervert came up with this" from Nancy Lebovitz's catalogue.)<br>
<br>
So findfs, fstrim, and maybe setpriv and/or uevent? And remember to do <br>
unexpand. And the rest of the roadmap entries. See also <br>
<a href="https://mstdn.jp/@landley/113777106743267398" rel="noreferrer" target="_blank">https://mstdn.jp/@landley/113777106743267398</a> and so on. (I have a todo <br>
heap.)<br>
<br>
Again, differences _within_ a command, I dunno about, but other than <br>
lack of builtin https and not micromanaging binary size with <br>
UNUSED_PARAM and MAIN_EXTERNALLY_VISIBLE style black magic (our <br>
standalone "false" is probably way bigger than theirs), I'm unaware of <br>
any places an existing promoted toybox command is functionally WORSE <br>
than busybox. (If you find one, tell me.)<br></blockquote><div><br></div><div>yeah, for that i think you just have to scan down</div><div><br></div><div><a href="https://landley.net/toybox/help.html">https://landley.net/toybox/help.html</a></div><div> </div><div>and</div><div><br></div><div><a href="https://man.archlinux.org/man/busybox.1.en#COMMAND_DESCRIPTIONS">https://man.archlinux.org/man/busybox.1.en#COMMAND_DESCRIPTIONS</a></div><div><br></div><div>and see if there's anything you care about.</div><div><br></div><div>(<a href="http://busybox.net">busybox.net</a> seems to be down atm.)</div><div><br></div><div>or just "suck it and see", which is basically what Android did for the host build.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Rob<br>
_______________________________________________<br>
Toybox mailing list<br>
<a href="mailto:Toybox@lists.landley.net" target="_blank">Toybox@lists.landley.net</a><br>
<a href="http://lists.landley.net/listinfo.cgi/toybox-landley.net" rel="noreferrer" target="_blank">http://lists.landley.net/listinfo.cgi/toybox-landley.net</a><br>
</blockquote></div></div>