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