blob: 26146e42d7bcf367e969b57e3b88de75d482c185 [file] [log] [blame]
Rob Landley349ff522014-01-04 13:09:42 -06001<html><head><title>toybox roadmap</title>
Rob Landley8f90d3a2012-07-21 23:58:40 -05002<!--#include file="header.html" -->
3<title>Toybox Roadmap</title>
4
5<h2>Goals and use cases</h2>
6
7<p>We have several potential use cases for a new set of command line
8utilities, and are using those to determine which commands to implement
9for Toybox's 1.0 release.</p>
10
Rob Landley9a69a922013-02-23 18:32:08 -060011<p>The most interesting standards are POSIX-2008 (also known as the Single
12Unix Specification version 4) and the Linux Standard Base (version 4.1).
13The main test harness including toybox in Aboriginal Linux and if that can
14build itself using the result to build Linux From Scratch (version 6.8).
15We also aim to replace Android's Toolbox.</p>
16
17<p>At a secondary level we'd like to meet other use cases. We've analyzed
18the commands provided by similar projects (klibc, sash, sbase, s6, embutils,
19nash, and beastiebox), along with various vendor configurations of busybox,
20and some end user requests.</p>
21
22<p>Finally, we'd like to provide a good replacement for the Bash shell,
23which was the first program Linux ever ran and remains the standard shell
24of Linux no matter what Ubuntu says. This doesn't mean including the full
25set of Bash 4.x functionality, but does involve {various,features} beyond
26posix.</p>
Rob Landley8f90d3a2012-07-21 23:58:40 -050027
28<p>See the <a href=status.html>status page</a> for the combined list
29and progress towards implementing it.</p>
30
Rob Landley9a69a922013-02-23 18:32:08 -060031<ul>
32<li><a href=#susv4>POSIX-2008/SUSv4</a></li>
33<li><a href=#sigh>Linux "Standard" Base</a></li>
34<li><a href=#dev_env>Development Environment</a></li>
35<li><a href=#android>Android Toolbox</a></li>
Rob Landleya136fa52014-12-20 14:58:03 -060036<li><a href=#tizen>Tizen Core</a></li>
Rob Landley348a8002014-04-09 07:57:08 -050037<li>Miscelaneous: <a href=#klibc>klibc</a>, <a href=#glibc>glibc</a>,
38<a href=#sash>sash</a>, <a href=#sbase>sbase</a>, <a href=#s6>s6</a>...</li>
Rob Landley9a69a922013-02-23 18:32:08 -060039</ul>
40
Rob Landley8f90d3a2012-07-21 23:58:40 -050041<hr />
42<a name="standards">
43<h2>Use case: standards compliance.</h2>
44
Rob Landley571b0702012-11-13 16:13:45 -060045<h3><a name=susv4 /><a href="#susv4">POSIX-2008/SUSv4</a></h3>
Rob Landley8f90d3a2012-07-21 23:58:40 -050046<p>The best standards are the kind that describe reality, rather than
47attempting to impose a new one. (I.E. a good standard should document, not
48legislate.)</p>
49
50<p>The kind of standards which describe existing reality tend to be approved by
51more than one standards body, such ANSI and ISO both approving C. That's why
52the IEEE POSIX committee's 2008 standard, the Single Unix Specification version
534, and the Open Group Base Specification edition 7 are all the same standard
54from three sources.</p>
55
Rob Landley62f00212012-12-06 15:15:30 -060056<p>The <a href="http://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html">"utilities"
Rob Landley8f90d3a2012-07-21 23:58:40 -050057section</a>
58of these standards is devoted to the unix command line, and are the best such
59standard for our purposes. (My earlier work on BusyBox was implemented with
60regard to SUSv3, an earlier version of this standard.)</p>
61
62<h3>Problems with the standard</h3>
63
64<p>Unfortunately, these standards describe a subset of reality, lacking any
65mention of commands such as init, login, or mount required to actually boot a
66system. It provides ipcrm and ipcs, but not ipcmk, so you can use System V IPC
67resources but not create them.</p>
68
69<p>These standards also contain a large number of commands that are
70inappropriate for toybox to implement in its 1.0 release. (Perhaps some of
71these could be reintroduced in later releases, but not now.)</p>
72
73<p>Starting with the full "utilities" list, we first remove generally obsolete
74commands (compess ed ex pr uncompress uccp uustat uux), commands for the
75pre-CVS "SCCS" source control system (admin delta get prs rmdel sact sccs unget
76val what), fortran support (asa fort77), and batch processing support (batch
77qalter qdel qhold qmove qmsg qrerun qrls qselect qsig qstat qsub).</p>
78
79<p>Some commands are for a compiler toolchain (ar c99 cflow ctags cxref gencat
80iconv lex m4 make nm strings strip tsort yacc), which is outside of toybox's
81mandate and should be supplied externally. (Again, some of these may be
82revisited later, but not for toybox 1.0.)</p>
83
84<p>Some commands are part of a command shell, and cannot be implemented as
85separate executables (alias bg cd command fc fg getopts hash jobs kill read
86type ulimit umask unalias wait). These may be revisited as part of a built-in
87toybox shell, but are not exported into $PATH via symlinks. (If you fork a
88child process and have it "cd" then exit, you've accomplished nothing.)</p>
89
90<p>A few other commands are judgement calls, providing command-line
91internationalization support (iconv locale localedef), System V inter-process
92communication (ipcrm ipcs), and cross-tty communication from the minicomputer
93days (talk mesg write). The "pax" utility was supplanted by tar, "mailx" is
94a command line email client, and "lp" submits files for printing to... what
95exactly? (cups?) The standard defines crontab but not crond.</p>
96
97<p>Removing all of that leaves the following commands, which toybox should
98implement:</p>
99
100<blockquote><b>
101<span id=posix>
102at awk basename bc cal cat chgrp chmod chown cksum cmp comm cp
103csplit cut date dd df diff dirname du echo env expand expr false file find
104fold fuser getconf grep head id join kill link ln logger logname ls man
105mkdir mkfifo more mv newgrp nice nl nohup od paste patch pathchk printf ps
106pwd renice rm rmdir sed sh sleep sort split stty tabs tail tee test time
107touch tput tr true tty uname unexpand uniq unlink uudecode uuencode vi wc
108who xargs zcat
109</span>
110</b></blockquote>
111
Rob Landley571b0702012-11-13 16:13:45 -0600112<h3><a name=sigh /><a href="#sigh">Linux Standard Base</a></h3>
Rob Landley8f90d3a2012-07-21 23:58:40 -0500113
114<p>One attempt to supplement POSIX towards an actual usable system was the
115Linux Standard Base. Unfortunately, the quality of this "standard" is
116fairly low.</p>
117
118<p>POSIX allowed its standards process to be compromised
119by leaving things out, thus allowing IBM mainframes and Windows NT to drive
120a truck through the holes and declare themselves compilant. But it means what
121they DID standardize tends to be respected.</p>
122
123<p>The Linux Standard Base's failure mode is different, they respond to
124pressure by including special-case crap, such as allowing Red Hat to shoehorn
Rob Landley62f00212012-12-06 15:15:30 -0600125RPM on the standard even though all sorts of distros (Debian, Slackware, Arch,
126Gentoo) don't use it and probably never will. This means anything in the LSB is
Rob Landley8f90d3a2012-07-21 23:58:40 -0500127at best a suggestion: arbitrary portions of this standard are widely
128ignored.</p>
129
130<p>The LSB does specify a <a href=http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/cmdbehav.html>list of command line
131utilities</a>:</p>
132
133<blockquote><b>
134ar at awk batch bc chfn chsh col cpio crontab df dmesg du echo egrep
135fgrep file fuser gettext grep groupadd groupdel groupmod groups
136gunzip gzip hostname install install_initd ipcrm ipcs killall lpr ls
137lsb_release m4 md5sum mknod mktemp more mount msgfmt newgrp od passwd
138patch pidof remove_initd renice sed sendmail seq sh shutdown su sync
139tar umount useradd userdel usermod xargs zcat
140</b></blockquote>
141
142<p>Where posix specifies one of those commands, LSB's deltas tend to be
143accomodations for broken tool versions which aren't up to date with the
144standard yet. (See <a href=http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/more.html>more</a> and <a href=http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/xargs.html>xargs</a>
145for examples.)</p>
146
147<p>Since we've already committed to using our own judgement to skip bits of
148POSIX, and LSB's "judgement" in this regard is purely bug workarounds to declare
149various legacy tool implementations "compliant", this means we're mostly
150interested in the set of tools that aren't specified in posix at all.</p>
151
152<p>Of these, gettext and msgfmt are internationalization, install_initd and
153remove_initd aren't present on ubuntu 10.04, lpr is out of scope, and
154lsb_release is a distro issue (it's a nice command, but the output of
155lsb_release -a is the name and version number of the linux distro you're
156running, which toybox doesn't know).</p>
157
158<p>This leaves:</p>
159
160<blockquote><b>
161<span id=lsb>
162chfn chsh dmesg egrep fgrep groupadd groupdel groupmod groups
163gunzip gzip hostname install killall md5sum
164mknod mktemp mount passwd pidof sendmail seq shutdown
165su sync tar umount useradd userdel usermod zcat
166</span>
167</b></blockquote>
168
169<hr />
170<a name="dev_env">
Rob Landley571b0702012-11-13 16:13:45 -0600171<h2><a href="#dev_env">Use case: provide a self-hosting development environment</a></h2>
Rob Landley8f90d3a2012-07-21 23:58:40 -0500172
173<p>The following commands are enough to build the Aboriginal Linux development
174environment, boot it to a shell prompt, and build Linux From Scratch 6.8 under
175it. (Aboriginal Linux currently uses BusyBox for this, thus provides a
176drop-in test environment for toybox. We install both implementations side
177by side, redirecting the symlinks a command at a time until the older
178package is no longer used, and can be removed.)</p>
179
180<p>This use case includes running init scripts and other shell scripts, running
181configure, make, and install in each package, and providing basic command line
182facilities such as a text editor. (It does not include a compiler toolchain or
183C library, those are outside the scope of this project.)</p>
184
185<blockquote><b>
186<span id=development>
187bzcat cat cp dirname echo env patch rmdir sha1sum sleep sort sync
188true uname wc which yes zcat
189awk basename bzip2 chmod chown cmp cut date dd diff
190egrep expr find grep gzip head hostname id install ln ls
191mkdir mktemp mv od readlink rm sed sh tail tar touch tr uniq
192wget whoami xargs chgrp comm gunzip less logname man split
193tee test time bunzip2 chgrp chroot comm cpio dmesg
194dnsdomainname ftpd ftpget ftpput gunzip ifconfig init less
195logname losetup man mdev mount mountpoint nc pgrep pkill
196pwd route split stat switch_root tac umount vi
197</span>
198</b></blockquote>
199
200<p>Note: Aboriginal Linux installs bash 2.05b as #!/bin/sh and its scripts
201require bash extensions not present in shells such as busybox ash.
202This means that toysh needs to supply several bash extensions _and_ work
203when called under the name "bash".</p>
204
Rob Landley8fe18142014-10-07 14:11:54 -0500205<p>The <a href=http://landley.net/aboriginal>Aboriginal Linux</a>
206self-bootstrapping build still uses the following busybox commands,
enh1fb20802014-11-24 17:26:09 -0600207not yet supplied by toybox:</p>
Rob Landley8fe18142014-10-07 14:11:54 -0500208
209<blockquote><p>
210ash awk bunzip2 bzip2 dd diff expr fdisk ftpd ftpget ftpput gunzip
211gzip less man pgrep ping pkill ps route sed sh sha512sum tar test tr unxz vi
212wget xzcat zcat</p></blockquote>
213
214<p>Many of those are in "pending". Most of the archive commands are needed
215because busybox tar doesn't call external versions. The remaining "difficult"
216commands are vi, awk, and ash.</p>
217
Rob Landley8f90d3a2012-07-21 23:58:40 -0500218<hr />
Rob Landley571b0702012-11-13 16:13:45 -0600219<h2><a name=android /><a href="#android">Use case: Replacing Android Toolbox</a></h2>
Rob Landley8f90d3a2012-07-21 23:58:40 -0500220
Rob Landleyfdc10c92012-10-16 17:09:30 -0500221<p>Android has a policy against GPL in userspace, so even though BusyBox
222predates Android by many years, they couldn't use it. Instead they grabbed
223an old version of ash and implemented their own command line utility set
enh1fb20802014-11-24 17:26:09 -0600224called "toolbox". ash was later replaced by
225<a href="https://www.mirbsd.org/mksh.htm">mksh</a>; toolbox is being
226replaced by toybox.</p>
Rob Landley8f90d3a2012-07-21 23:58:40 -0500227
Rob Landleyfdc10c92012-10-16 17:09:30 -0500228<p>Toolbox doesn't have its own repository, instead it's part of Android's
229<a href=https://android.googlesource.com/platform/system/core>system/core
Elliott Hughese00c7862015-03-28 02:53:08 -0500230git repository</a>.</p>
Rob Landley8f90d3a2012-07-21 23:58:40 -0500231
Rob Landleyfdc10c92012-10-16 17:09:30 -0500232<h3>Toolbox commands:</h3>
233
enh1fb20802014-11-24 17:26:09 -0600234<p>According to system/core/toolbox/Android.mk the toolbox directory builds
235the following commands:</p>
Rob Landley8f90d3a2012-07-21 23:58:40 -0500236
237<blockquote><b>
Elliott Hughese00c7862015-03-28 02:53:08 -0500238dd du df getevent getprop iftop ioctl ionice load_policy log ls
Elliott Hughes70722142015-04-10 16:57:54 -0500239lsof mount nandread newfs_msdos ps prlimit renice restorecon
240sendevent setprop start stop top uptime watchprops
Rob Landleyfdc10c92012-10-16 17:09:30 -0500241</b></blockquote>
Rob Landley8f90d3a2012-07-21 23:58:40 -0500242
Rob Landleyfdc10c92012-10-16 17:09:30 -0500243<h3>Other Android core commands</h3>
244
enh1fb20802014-11-24 17:26:09 -0600245<p>Other than the toolbox directory, the currently interesting
Elliott Hughes2c7028a2015-03-23 11:44:56 -0500246subdirectories in the core repository are gpttool, init,
Elliott Hughes8c4fdd82015-02-07 19:51:27 -0600247logcat, logwrapper, mkbootimg, reboot, and run-as.</p>
Rob Landleyfdc10c92012-10-16 17:09:30 -0500248
249<ul>
Rob Landleyfdc10c92012-10-16 17:09:30 -0500250<li><b>gpttool</b> - subset of fdisk</li>
251<li><b>init</b> - Android's PID 1</li>
252<li><b>logcat</b> - read android log format</li>
253<li><b>logwrapper</b> - redirect stdio to android log</li>
254<li><b>mkbootimg</b> - create signed boot image</li>
enh1fb20802014-11-24 17:26:09 -0600255<li><b>reboot</b> - Android's reboot(1)</li>
Rob Landleyfdc10c92012-10-16 17:09:30 -0500256<li><b>run-as</b> - subset of sudo</li>
Rob Landleyfdc10c92012-10-16 17:09:30 -0500257</ul>
258
259<p>Almost all of these reinvent an existing wheel with less functionality and a
260different user interface. We may want to provide that interface, but
Elliott Hughes2c7028a2015-03-23 11:44:56 -0500261implementing the full commands (fdisk, init, and sudo) come first.</p>
Rob Landleyfdc10c92012-10-16 17:09:30 -0500262
enh1fb20802014-11-24 17:26:09 -0600263<p>Also, gpttool and mkbootimg are install tools.
264These aren't a priority if android wants to use its own
Rob Landleyfdc10c92012-10-16 17:09:30 -0500265bespoke code to install itself.</p>
266
267<h3>Analysis</h3>
268
269<p>For reference, combining everything listed above, we get:</p>
270
271<blockquote><b>
Elliott Hughese00c7862015-03-28 02:53:08 -0500272dd du df getevent getprop gpttool iftop init ioctl ionice
Elliott Hughes70722142015-04-10 16:57:54 -0500273log logcat logwrapper ls lsof mkbootimg mount nandread
274newfs_msdos ps prlimit reboot renice restorecon run-as
275sendevent setprop start stop top uptime watchprops
Rob Landleyfdc10c92012-10-16 17:09:30 -0500276</b></blockquote>
277
278<p>We may eventually implement all of that, but for toybox 1.0 we need to
enh1fb20802014-11-24 17:26:09 -0600279focus a bit. For our first pass, let's ignore selinux,
280and grab just logcat and logwrapper from the "core"
Rob Landleyfdc10c92012-10-16 17:09:30 -0500281commands (since the rest have some full/standard version providing that
282functionality, which we can implement a shim interface for later).</p>
283
Elliott Hughes2c7028a2015-03-23 11:44:56 -0500284<p>This means toybox should implement (or finish implementing):</p>
Rob Landley8f90d3a2012-07-21 23:58:40 -0500285<blockquote><b>
286<span id=toolbox>
Elliott Hughes2c7028a2015-03-23 11:44:56 -0500287dd du df getevent getprop iftop ioctl ionice log logcat logwrapper ls lsof
Elliott Hughes70722142015-04-10 16:57:54 -0500288mount nandread newfs_msdos ps prlimit renice schedtop sendevent
289setprop smd start stop top uptime watchprops
Rob Landley8f90d3a2012-07-21 23:58:40 -0500290</span>
Rob Landleyc26ca6e2013-01-31 04:05:56 -0600291</b></blockquote>
Rob Landleyfdc10c92012-10-16 17:09:30 -0500292
Rob Landleya136fa52014-12-20 14:58:03 -0600293<hr />
294<h2><a name=tizen /><a href="#tizen">Use case: Tizen Core</a></h2>
295
296<p>The Tizen project has expressed a desire to eliminate GPLv3 software
297from its core system, and is installing toybox as
298<a href=https://wiki.tizen.org/wiki/Toybox>part of this process</a>.</p>
299
300<p>They have a fairly long list of new commands they'd like to see in toybox:</p>
301
302<blockquote><b>
303<span id=tizen>
304arch base64 users dir vdir unexpand shred join csplit
305hostid nproc runcon sha224 sha256 sha384 sha512 sha3 mkfs.vfat fsck.vfat
306dosfslabel uname stdbuf pinky diff3 sdiff zcmp zdiff zegrep zfgrep zless zmore
307</span>
308</blockquote>
309
310<p>In addition, they'd like to use several commands currently in pending:</p>
311
312<blockquote><b>
313<span id=tizen>
314tar diff printf wget rsync fdisk vi less tr test stty fold expr dd
315</span>
316</b></blockquote>
317
Rob Landley9a69a922013-02-23 18:32:08 -0600318<hr /><a name=klibc />
Rob Landley934b2d32013-05-10 18:54:14 -0500319<h2>klibc:</h2>
Rob Landley9a69a922013-02-23 18:32:08 -0600320
321<p>Long ago some kernel developers came up with a project called
322<a href=http://en.wikipedia.org/wiki/Klibc>klibc</a>.
323After a decade of development it still has no web page or HOWTO,
324and nobody's quite sure if the license is BSD or GPL. It inexplicably
325<a href=http://www.infoworld.com/d/data-center/perl-isnt-going-anywhere-better-or-worse-211580>requires perl to build</a>, and seems like an ideal candidate for
326replacement.</p>
327
328<p>In addition to a C library even less capable than bionic (obsoleted by
329musl), klibc builds a random assortment of executables to run init scripts
330with. There's no multiplexer command, these are individual executables:</p>
331
332<blockquote><p>
333cat chroot cpio dd dmesg false fixdep fstype gunzip gzip halt ipconfig kill
334kinit ln losetup ls minips mkdir mkfifo mknodes
335mksyntax mount mv nfsmount nuke pivot_root poweroff readlink reboot resume
336run-init sh sha1hash sleep sync true umount uname zcat
337</p></blockquote>
338
339<p>To get that list, build klibc according to the instructions (I
340<a href=http://landley.net/notes-2013.html#23-01-2013>looked at</a> version
3412.0.2 and did cd klibc-*; ln -s /output/of/kernel/make/headers_install
342linux; make) then <b>echo $(for i in $(find . -type f); do file $i | grep -q
343executable && basename $i; done | grep -v '[.]g$' | sort -u)</b> to find
344executables, then eliminated the *.so files and *.shared duplicates.</p>
345
346<p>Some of those binaries are build-time tools that don't get installed,
347which removes mknodes, mksyntax, sha1hash, and fixdep from the list.
348(And sha1hash is just an unpolished sha1sum anyway.)</p>
349
350<p>The run-init command is more commonly called switch_root, nuke is just
351"rm -rf -- $@", and minips is more commonly called "ps". I'm not doing aliases
352for the oddball names.</p>
353
354<p>Yet more stale forks of dash and gzip sucked in here (see "dubious
355license terms" above), adding nothing to the other projects we've looked at.
356But we still need sh, gunzip, gzip, and zcat to replace this package.</p>
357
358<p>By the time I did the analysis toybox already had cat, chroot, dmesg, false,
359kill, ln, losetup, ls, mkdir, mkfifo, readlink, rm, switch_root, sleep, sync,
360true, and uname.</p>
361
362<p>The low hanging fruit is cpio, dd, ps, mv, and pivot_root.</p>
363
364<p>The "kinit" command is another gratuitous rename, it's init running as PID 1.
365The halt, poweroff, and reboot commands work with it.</p>
366
367<p>I've got mount and umount queued up already, fstype and nfsmount go with
368those. (And probably smbmount and p9mount, but this hasn't got one. Those
369are all about querying for login credentials, probably workable into the
370base mount command.)</p>
371
372<p>The ipconfig command here has a built in dhcp client, so it's ifconfig
373and dhcpcd and maybe some other stuff.</p>
374
375<p>The resume command is... weird. It finds a swap partition and reads data
376from it into a /proc file, something the kernel is capable of doing itself.
377(Even though the klibc author
378<a href=http://www.zytor.com/pipermail/klibc/2006-June/001748.html>attempted
379to remove</a> that capability from the kernel, current kernel/power/hibernate.c
380still parses "resume=" on the command line). And yet various distros seem to
381make use of klibc for this>
382Given the history of swsusp/hibernate (and
383<a href=http://lwn.net/Articles/333007>TuxOnIce</a>
384and <a href=http://lwn.net/Articles/242107>kexec jump</a>) I've lost track
385of the current state of the art here. Ah, Documentation/power/userland-swsusp.txt
386has the API docs, and <a href=http://suspend.sf.net>here's a better
387tool</a>...</p>
388
389<p>So the list of things actually in klibc are:</p>
390
391<blockquote><b>
Rob Landleyc166faf2013-09-01 07:25:37 -0500392<span id=klibc_cmd>
Rob Landley9a69a922013-02-23 18:32:08 -0600393cat chroot dmesg false kill ln losetup ls mkdir mkfifo readlink rm switch_root
394sleep sync true uname
395
396cpio dd ps mv pivot_root
397mount nfsmount fstype umount
398sh gunzip gzip zcat
399kinit halt poweroff reboot
400ipconfig
401resume
402</span>
403</b></blockquote>
404
405<hr />
Rob Landley348a8002014-04-09 07:57:08 -0500406<a name=glibc />
407<h2>glibc</h2>
408
409<p>Rather a lot of command line utilities come bundled with glibc:</p>
410
411<blockquote><b>
412catchsegv getconf getent iconv iconvconfig ldconfig ldd locale localedef
413mtrace nscd rpcent rpcinfo tzselect zdump zic
414</b></blockquote>
415
Isaac Dunham931425c2014-04-12 17:26:44 -0500416<p>Of those, musl libc only implements ldd.</p>
Rob Landleycbd77522014-04-12 20:39:33 -0500417
Isaac Dunham931425c2014-04-12 17:26:44 -0500418<p>catchsegv is a rudimentary debugger, probably out of scope for toybox.</p>
Rob Landleycbd77522014-04-12 20:39:33 -0500419
Isaac Dunham931425c2014-04-12 17:26:44 -0500420<p>iconv has been <a href="#susv4">previously discussed</a>.</p>
Rob Landleycbd77522014-04-12 20:39:33 -0500421
Isaac Dunham931425c2014-04-12 17:26:44 -0500422<p>iconvconfig is only relevant if iconv is user-configurable; musl uses a
423non-configurable iconv.</p>
Rob Landleycbd77522014-04-12 20:39:33 -0500424
Isaac Dunham931425c2014-04-12 17:26:44 -0500425<p>getconf is a posix utility which displays several variables from
426unistd.h; it probably belongs in the development toolchain.</p>
Rob Landleycbd77522014-04-12 20:39:33 -0500427
428<p>getent handles retrieving entries from passwd-style databases
429(in a rather lame way) and is trivially replacable by grep.</p>
430
Isaac Dunham931425c2014-04-12 17:26:44 -0500431<p>locale was discussed under <a href=#susv4>posix</a>.
432localedef compiles locale definitions, which musl currently does not use.</p>
433
434<p>mtrace is a perl script to use the malloc debugging that glibc has built-in;
435this is not relevant for musl, and would necessarily vary with libc. </p>
Rob Landleycbd77522014-04-12 20:39:33 -0500436
Isaac Dunham931425c2014-04-12 17:26:44 -0500437<p>nscd is a name service caching daemon, which is not yet relevant for musl.
438rpcinfo and rpcent are related to rpc, which musl does not include.</p>
439
Rob Landleycbd77522014-04-12 20:39:33 -0500440<p>The remaining commands involve glibc's bundled timezone database,
441which seems to be derived from the <a href=http://www.iana.org/time-zones>IANA
442timezone database</a>. Unless we want to maintain our own fork of the
443standards body's database like glibc does, these are of no interest,
444but for completeness:</p>
445
Isaac Dunham931425c2014-04-12 17:26:44 -0500446<p>tzselect outputs a TZ variable correponding to user input.
447The documentation does not indicate how to use it in a script, but it seems
448that Debian may have done so.
449zdump prints current time in each of several timezones, optionally
450outputting a great deal of extra information about each timezone.
Rob Landleycbd77522014-04-12 20:39:33 -0500451zic converts a description of a timezone to a file in tz format.</p>
Isaac Dunham931425c2014-04-12 17:26:44 -0500452
Rob Landleycbd77522014-04-12 20:39:33 -0500453<p>None of glibc's bundled commands are currently of interest to toybox.</p>
Isaac Dunham931425c2014-04-12 17:26:44 -0500454
Isaac Dunham931425c2014-04-12 17:26:44 -0500455</b></blockquote>
Rob Landley348a8002014-04-09 07:57:08 -0500456
457<hr />
Rob Landley9a69a922013-02-23 18:32:08 -0600458<a name=sash />
459<h2>Stand-Alone Shell</h2>
460
461<p>Wikipedia has <a href=http://en.wikipedia.org/wiki/Stand-alone_shell>a good
462summary of sash</a>, with links. The original Stand-Alone Shell project reached
463a stopping point, and then <a href=http://www.baiti.net/sash>"sash plus
464patches"</a> extended it a bit further. The result is a megabyte executable
465that provides 40 commands.</p>
466
467<p>Sash is a shell with built-in commands. It doesn't have a multiplexer
468command, meaning "sash ls -l" doesn't work (you have to go "sash -c 'ls -l'").
469</p>
470
471<p>The list of commands can be obtained via building it and doing
472"echo help | ./sash | awk '{print $1}' | sed 's/^-//' | xargs echo", which
473gives us:</p>
474
475<blockquote><b>
476alias aliasall ar cd chattr chgrp chmod chown cmp cp chroot dd echo ed exec
477exit file find grep gunzip gzip help kill losetup losetup ln ls lsattr mkdir
478mknod more mount mv pivot_root printenv prompt pwd quit rm rmdir setenv source
479sum sync tar touch umask umount unalias where
480</b></blockquote>
481
482<p>Plus sh because it's a shell. A dozen or so commands can only sanely be
483implemented as shell builtins (alias aliasall cd exec exit prompt quit setenv
484source umask unalias), where is an alias for which, and at triage time toybox
485already has chgrp, chmod, chown, cmp, cp, chroot, echo, help, kill, losetup,
486ln, ls, mkdir, mknod, printenv, pwd, rm, rmdir, sync, and touch.</p>
487
488<p>This leaves:</p>
489
490<blockquote><b>
491<span id=sash_cmd>
492ar chattr dd ed file find grep gunzip gzip lsattr more mount mv pivot_root
493sh sum tar umount
494</span>
495</b></blockquote>
496
497<p>(For once, this project doesn't include a fork of gzip, instead
498it sucks in -lz from the host.)</p>
499
500<hr />
501<a name=sbase />
502<h2>sbase:</h2>
503
504<p>It's <a href=http://git.suckless.org/sbase>on suckless</a>. So far it's
505implemented:</p>
506
507<blockquote><p>
Rob Landleyc166faf2013-09-01 07:25:37 -0500508<span id=sbase_cmd>
Rob Landley9a69a922013-02-23 18:32:08 -0600509basename cat chmod chown cksum cmp cp date dirname echo false fold grep head
510kill ln ls mc mkdir mkfifo mv nl nohup pwd rm seq sleep sort tail tee test
511touch true tty uname uniq wc yes
512</span>
513</p></blockquote>
514
515<p>And has a TODO list:</p>
516
517<blockquote><p>
Rob Landleyc166faf2013-09-01 07:25:37 -0500518<span id=sbase_cmd>
Rob Landley9a69a922013-02-23 18:32:08 -0600519cal chgrp chvt comm cut df diff du env expand expr id md5sum nice paste
520printenv printf readlink rmdir seq sha1sum split sync test tr unexpand unlink
521who
522</span>
523</p></blockquote>
524
525<p>At triage time, of the first list I still need to do: fold grep mc mv nl. Of
526the second list: diff expr paste printf split test tr unexpand who.</p>
527
528<hr />
529<a name=s6 />
530<h2>s6</h2>
531
532<p>The website <a href=http://skarnet.org/software/>skarnet</a> has a bunch
533of small utilities as part of something called "s6". This includes the
534<a href=http://skarnet.org/software/s6-portable-utils>s6-portabile-utils</a>
535and the <a href=http://skarnet.org/software/s6-linux-utils>s6-linux-utils</a>.
536</p>
537
538<p>Both packages rely on multiple bespoke external libraries without which
539they can't compile. The source is completely uncommented and doesn't wrap at
54080 characters. Doing a find for *.c files brings up the following commands:</p>
541
542<blockquote><b>
543<span id=s6>
544basename cat chmod chown chroot clock cut devd dirname echo env expr false
545format-filter freeramdisk grep halt head hiercopy hostname linkname ln
546logwatch ls maximumtime memoryhog mkdir mkfifo mount nice nuke pause
547pivotchroot poweroff printenv quote quote-filter reboot rename rmrf sleep
548sort swapoff swapon sync tail test touch true umount uniquename unquote
549unquote-filter update-symlinks
550</span>
551</b></blockquote>
552
553<p>Triage: memoryhog isn't even listed on the website nor does it have
554a documentation file, clock seems like a subset
555of date, devd is some sort of netlink wrapper that spawns its command line
556every time it gets a message (maybe this is meant to implement part of
557udev/mdev?), format-filter is sort of awk's '{print $2}' function split out
558into its own command, hiercopy a subset of "cp -r", maximumtime is something
559I implemented as a shell script (more/timeout.sh in Aboriginal Linux),
560nuke isn't the same as klibc (this one's "kill SIG -1" only with hardwared
561SIG options), pause is a program that literally waits to be killed (I
562generally sleep 999999999 which is a little over 30 years),
563pivotchroot is a subset of switch_root, rmrf is rm -rf...</p>
564
565<p>I see "nuke" resurface, and if "rmrf" wasn't also here I might think
566klibc had a point.</b>
567
568<blockquote>
569basename cat chmod chown chroot cut dirname echo env expr false
570freeramdisk grep halt head hostname linkname ln
571logwatch ls mkdir mkfifo mount nice
572pivotchroot poweroff printenv quote quote-filter reboot rename sleep
573sort swapoff swapon sync tail test touch true umount uniquename unquote
574unquote-filter update-symlinks
575</blockquote>
576
577
578<hr />
579<a name=nash />
580<h2>nash:</h2>
581
582<p>Red Hat's nash was part of its "mkinitrd" package, replacement for a shell
583and utilities on the boot floppy back in the 1990's (the same general idea
584as BusyBox, developed independently). Red Hat discontinued nash development
585in 2010, replacing it with dracut (which collects together existing packages,
586including busybox).</p>
587
588<p>I couldn't figure out how to beat source code out of
589<a href=http://pkgs.fedoraproject.org/git/mkinitrd>Fedora's current git</a>
590repository. The last release version that used it was Fedora Core 12
591which has <a href=http://archive.fedoraproject.org/pub/archive/fedora/linux/releases/12/Fedora/source/SRPMS/mkinitrd-6.0.93-1.fc12.src.rpm>a source rpm</a>
592that can be unwound with "rpm2cpio mkinitrd.src.rpm | cpio -i -d -H newc
593--no-absolute-filenames" and in there is a mkinitrd-6.0.93.tar.bz2 which
594has the source.</p>
595
596<p>In addition to being a bit like a command shell, the nash man page lists the
597following commands:</p>
598
599<blockquote><p>
600access echo find losetup mkdevices mkdir mknod mkdmnod mkrootdev mount
601pivot_root readlink raidautorun setquiet showlabels sleep switchroot umount
602</p></blockquote>
603
604<p>Oddly, the only occurrence of the string pivot_root in the nash source code
605is in the man page, the command isn't there. (It seems to have been removed
606when the underscoreless switchroot went in.)</p>
607
608<p>A more complete list seems to be the handlers[] array in nash.c:</p>
609
610<blockquote><p>
611access buildEnv cat cond cp daemonize dm echo exec exit find kernelopt
612loadDrivers loadpolicy mkchardevs mkblktab mkblkdevs mkdir mkdmnod mknod
613mkrootdev mount netname network null plymouth hotplug killplug losetup
614ln ls raidautorun readlink resume resolveDevice rmparts setDeviceEnv
615setquiet setuproot showelfinterp showlabels sleep stabilized status switchroot
616umount waitdev
617</p></blockquote>
618
619<p>This list is nuts: "plymouth" is an alias for "null" which is basically
620"true" (which thie above list doesn't have). Things like buildEnv and
621loadDrivers are bespoke Red Hat behavior that might as well be hardwired in
622to nash's main() without being called.</p>
623
624<p>Instead of eliminating items
625from the list with an explanation for each, I'm just going to cherry pick
626a few: the device mapper (dm, raidautorun) is probably interesting,
627hotplug (may be obsolete due to kernel changes that now load firmware
628directly), and another "resume" ala klibc.</p>
629
630<p>But mostly: I don't care about this one. And neither does Red Hat anymore.</p>
631
Rob Landleyca04c7f2013-03-27 22:34:28 -0500632<p>Verdict: ignore</p>
633
Rob Landley9a69a922013-02-23 18:32:08 -0600634<hr />
635<a name=beastiebox />
636<h2>Beastiebox</h2>
637
638<p>Back in 2008, the BSD guys vented some busybox-envy
639<a href=http://beastiebox.sourceforge.net>on sourceforge</a>. Then stopped.
640Their repository is still in CVS, hasn't been touched in years, it's a giant
641hairball of existing code sucked together. (The web page says the author
642is aware of crunchgen, but decided to do this by hand anyway. This is not
643a collection of new code, it's a katamari of existing code rolled up in a
644ball.)</p>
645
646<p>Combining the set of commands listed on the web page with the set of
647man pages in the source gives us:</P>
648
649<blockquote><p>
650[ cat chmod cp csh date df disklabel dmesg echo ex fdisk fsck fsck_ffs getty
651halt hostname ifconfig init kill less lesskey ln login ls lv mksh more mount
652mount_ffs mv pfctl ping poweroff ps reboot rm route sed sh stty sysctl tar test
653traceroute umount vi wiconfig
654</p></blockquote>
655
656<p>Apparently lv is the missing link ed and vi, copyright 1982-1997 (do not
657want), ex is another obsolete vi mode, lesskey is "used to
658specify a set of key bindings to be used with less", and csh is a shell they
659sucked in, [ is an alias for test. Several more bsd-isms that don't have Linux
660equivalents (even in the ubuntu "install this package" search) are
661disklabel, fsck_ffs, mount_ffs, and pfctl. And wiconfig is a wavelan interface
662network card driver utility. Subtracting all that and the commands toybox
663already implements at triage time, we get:</p>
664
665<blockquote><p>
666<span id=beastiebox_cmd>
667fdisk fsck getty halt ifconfig init kill less mksh more mount mv ping poweroff
668ps reboot route sed sh stty sysctl tar test traceroute umount vi
669</span>
670</p></blockquote>
671
672<p>Not a hugely interesting list, but eh.</p>
673
Rob Landleyca04c7f2013-03-27 22:34:28 -0500674<p>Verdict: ignore</p>
675
676<hr />
677<a name=BsdBox />
678<h2>BsdBox</h2>
679
680<p>Somebody decided to do a <a href=https://wiki.freebsd.org/AdrianChadd/BsdBox>multicall binary for freebsd</a>.</p>
681
682<p>They based it on crunchgen, a tool that glues existing programs together
683into an archive and uses the name to execute the right one. It has no
684simplification or code sharing benefits whatsoever, it's basically an
685archiver that produces executables.</p>
686
687<p>That's about where I stopped reading.</p>
688
689<p>Verdict: ignore.</p>
690
691<hr />
692<a name=slowaris />
693<h2>OpenSolaris Busybox</h2>
694
695<p>Somebody <a href=http://hub.opensolaris.org/bin/view/Project+busybox/>wrote
696a wiki page</a> saying that Busybox for OpenSolaris would be a good idea.</p>
697
698<p>The corresponding "files" tab is an auto-generated stub. The project never
699even got as far as suggesting commands to include before Oracle discontinued
700OpenSolaris.</p>
701
702<p>Verdict: ignore.</p>
703
Rob Landley8f90d3a2012-07-21 23:58:40 -0500704<hr />
705<h2>Requests:</h2>
706
Rob Landley8fe18142014-10-07 14:11:54 -0500707<p>The following additional commands have been requested (and often submitted)
708by various users:</p>
Rob Landley8f90d3a2012-07-21 23:58:40 -0500709<blockquote><b>
710<span id=request>
Rob Landley64b63192013-12-31 09:01:32 -0600711dig freeramdisk getty halt hexdump hwclock klogd modprobe ping ping6 pivot_root
Rob Landleyca04c7f2013-03-27 22:34:28 -0500712poweroff readahead rev sfdisk sudo syslogd taskset telnet telnetd tracepath
713traceroute unzip usleep vconfig zip free login modinfo unshare netcat help w
Rob Landley64b63192013-12-31 09:01:32 -0600714ntpd iwconfig iwlist rdate
Rob Landley7dbb9822014-02-21 22:24:02 -0600715dos2unix unix2dos catv clear
716pmap realpath setsid timeout truncate
717mkswap swapon swapoff
718count oneit fstype
719acpi blkid eject pwdx
Rob Landley8fe18142014-10-07 14:11:54 -0500720sulogin rfkill bootchartd
721arp makedevs sysctl killall5 crond crontab deluser last mkpasswd watch
722ipaddr iplink iproute blockdev rpm2cpio arping brctl dumpleases fsck
723tcpsvd tftpd
724factor fallocate fsfreeze inotifyd lspci nbd-client partprobe strings
Rob Landley3c994042015-01-01 17:37:57 -0600725base64 mix
Rob Landley8f90d3a2012-07-21 23:58:40 -0500726</span>
727</b></blockquote>
728
729<!-- #include "footer.html" -->
730