Toybox combines the most common Linux command line utilities together into a single BSD-licensed executable that's simple, small, fast, reasonably standards-compliant, and powerful enough to turn Android into a development environment. See the links on the left for details.
"Why," Arthur said, "is there a sofa in that field?" "I told you!" shouted Ford, leaping to his feet. "Eddies in the space-time continuum!" "And this is his sofa, is it?"
- The Hitchhiker's Guide to the Galaxy
Toybox 0.8.9 (git commit) is out, with prebuilt static binaries and mkroot images bootable under QEMU (built using a lightly patched linux-6.1).
The new nbd-server command interoperates with nbd-client to serve network block devices (using the v1 protocol), and Moritz Weber contributed a read-only git implementation to pending.
Features: New grep fast path for fixed or simple patterns that don't need the full regex engine (I.E. "^", ".", "$" but not "*" or "[]") most noticeable when searching for many patterns at once. Improved tar --xform support parsing flags= and trailing s/// scope flags (but using --xform now requires toybox sed in the $PATH).
Added sort -C, lsusb -i, netcat -n, swapoff -a -v, httpd -v, nbd-client -b, a uname -p stub to mollify package builds, sleep accepts multiple arguments, sed now parses interlaced -e and -f arguments in order, several new options in readlink and realpath (and better handling of relative paths), and UDP mode in netcat is more useful now: netcat -u -s 127.0.0.1 -p 9876 -l can type at netcat -u 127.0.0.1 9876 in both directions. (Figuring out when the other side hangs up is an unsolved problem, but that's UDP for you.) Elliott added ls -N.
Bugfixes: Fixed off by one error in sort -c output, fixed sed -z and other sed cases where Linux has never obeyed Posix (N at EOF does a default print, l escapes \n), patch --dry-run should no longer create or delete files, gzip/zcat couldn't handle concatenated archives, the ./configure of gmake 4.3 depends on test treating one argument -a as a synonym for -e, autodetectiong compression types in tar should be more reliable now and sanitize weird path corner cases (like .. past /) better, scripts/make.sh (and thus "make toybox") should no longer truncate log files stderr is redirected to, httpd now handles ? and # in URLs, xxd disables columns for -c 0 and groups for -g 0 (so you can get a long interrupted string of hex digits out of it), two fixes to mountpoint (the conversion to same_file() was inappropriate because the logic isn't quite the same, and -q should also quiet "not found" errors), fixed httpd not always displaying index.html files instead of directory contents, fixed comm - not recognizing it as stdin, and multiple fixes to timeout which now kills process group and thus child processes, isn't suspended by SIGTTIN, and recursive commands it calls don't inherit an inappropriate SIGCHLD handler.
Yi-Yo Chiang fixed loopback mount (the recent switch to xrunread() kept the newline from losetup's output) and added tail +123 (old-style synonym for tail -n +123). Daniel Mentz added scmversion to the modinfo tag list (Android uses it for external modules). Alexander Holler fixed su to not require /etc/shadow when run as root, and nomas2000 reported an inverted test in date's check for trailing rubbish. Daniel Mentz fixed an off by one in grep -f that discarded the last character of the pattern file's contents. Kelvin Zhang made modinfo better at handling symlinks. Antoni Villalonga fixed fmt on 64 bit big endian systems (like s390x and powerpc). Li Cheng fixed mount's type detection not autodetecting the need to bind mount files when type "none" was specified in fstab. Tomasz Sterna reported that modprobe resolving dependencies shouldn't feed a NULL pointer to the syscall's options arguments (the kernel goes -EWTF), and Vincent Donnefort made modprobe work when /proc/modules isn't available.
Library: The TOYFLAG_ARGFAIL() exit value is now the default error_msg() sets, sendfile() now falls back to the read/write loop for any error (not just EINVAL, the kernel sends ENOSYS and EXDEV and who knows what else), xgetrandom() can now return arbitrary amounts of data (looping internally as necessary), xwaitpid() returns status 127 for cases (like bad PID) which don't return a status for the PID, several fixes to xabspath() as part of the readlink/realpath work, new octal_deslash() to remove octal escapes common in kernel strings (ala /proc/mounts), the FLAG_x macros always use a 64 bit type now (so you don't have to worry about toys.optflags &= ~FLAG_x; blanking the top 32 bits), replaced memcmp() with new library function smemcmp() to placate ASAN when returning first difference in known differing arguments of unequal length. Elliott added three more filesystem types to fs_type_name() which is used by stat -f and friends.
Mkroot: New scripts/test_mkroot.sh runs each target under qemu to confirm 1) it boots, 2) the block device works, 3) networking works, and 4) the clock is set reasonably. It runs them in parallel, with an httpd instance on the host to fetch a file from, and a timeout to detect hangs. New scripts/root/overlay package copies $OVERLAY directory into target filesystem, ala scripts/mkroot.sh overlay OVERLAY=$PWD/blah The init script now mounts any /dev/?da on /mnt and when /mnt/init exists sets $HANDOFF to that instead of running a shell prompt, so you can provide automated control images that run code in the emulator automatically. (The emulator process still when whatever $HANDOFF called exits.)
Some kernel changes finally made it upstream so we can drop workarounds for them, such as kernel commit f8f0d06438e5 fixing the longstanding "allnoconfig has =y" issue so miniconfig doesn't need to add a magic #comment line forcing a symbol OFF anymore. The remaining kernel patches (including several maintained locally but hadn't merged into mkroot) moved to a seperate repository so mkroot.sh doesn't have to call sed on the build snapshot. (They're are also included in the mkroot binary release directory, and were all submitted to lkml months if not years ago.)
The host airlock setup (creating the temporary restricted environment mkroot builds packages in both so they don't pick up strange dependencies from the host, and to prove the build can use the toybox commands) removed a bunch of commands (dd, diff, vi, xzcat, ar, nm) no longer needed by the linux-6.1 build. The kernel patches also remove the need for gcc (it can use the "cc" symlink all modern distros install, and autodetects whether that points to gcc or clang) and bc (which is just generally obsolete). Left those two in for one more release, but NEXT time building a vanilla kernel without the gcc removal patch and bc removal patch may require you to add HOST_EXTRA="gcc bc" to the mkroot command line for the airlock build to add extra symlinks to root/build/airlock.
Added a kernel build for powerpc64 big endian, m68k and powerpc now support "run-qemu.sh -hda file.img", and m68k only has one /dev/?db (disabled Apple Desktop Bus in the config). Added basic module support (the kernel build saves modules in modules.cpio.gz so it can extract them when you rebuild the root filesystem but not the kernel) and added scripts/root/tests which (among other things) builds two innocuous modules that depend on each other (fscache and cachefiles) for modprobe/insmod testing that hopefully won't break anything else. (If there was a scripts/root/pending/ tests would be in it: it does not actually run the test suite under mkroot yet, because toysh needs work.)
Pending: Elliott made strace build on 32-bit x86. James Farrell added diff -f. Alexander Holler fixed two parameter substitution bugs in toysh. Rob fixed assignment suppression, && and || parsing, math priority, a number of ASAN test failures, untangled and commented the brace expansion logic, and other ongoing shell work.
A large rewrite of diff happened but couldn't be checked in unfinished because if people are using stuff out of pending, how do you do a pending for pending? (Meta-pending?)
Cleanup: cksum, od, file, getopt, gpiod, nbd-client, better output messages for host, and make base64 use line buffering. Moved -Wno-string-plus-int into portability.sh and had it only apply to clang. Moved num_cache() out of lib into netstat (its only user).
In the test suite plumbing, $SKIPNEXT was replaced by $SKIP holding a count that counts down with each test (so you can easily skip a block of tests). Fixed txpect to actually listen to error code (oops) and to not complain about multiple X. The old dochroot() and mkchroot() shell functions were removed from scripts/runtest.sh because they required root access to use (which mkroot does not). More conversion to use testcmd in individual command.tests (both to remove workarounds for shell builtins, and to be more concise). Remove redundant cleanup from several tests (which run as proper child processes now, and the work directory is deleted and recreated between each, so individual tests need less cleanup).
Portability: More tests now pass on MacOS and FreeBSD (weird filesystems, root vs wheel group name, dealing with headers that define stdin as a macro and don't define PATH_MAX, the ancient bash in MacOS doesn't understand &>>, won't let normal users use "chmod +s", symlinks don't have all permission bits set, no O_PATH and the Linux definition is used for something else, and so on), at least half of which Elliott did. Not sure we've quite got Mac and BSD doing "gmake test_singlecommand" right yet, but it's a lot closer. Added all the commands to make bsd_defconfig that compile on FreeBSD 13 (which is no guarantee they WORK). ASAN=1 should work in more places now, including make_test_command. The build uses $CC insted of cc in more places, and doesn't apply $ASAN for $HOSTCC (the legacy kconfig/ directory stands no chance).
Fedora inexplicably sticks \x09 style hex escapes into the dmesg output and expects them to be parsed. Android is still running the test suite under mksh which doesn't understand bashisms like <(command). LLVM insisted that "ptr - 1" could never be NULL (demonstrably untrue) and needed some (unsigned long) typecasts to force it to actually do the math. Khem Raj aliased timer_settime to timer_settime64 when the first isn't available. Antoni Villalonga debianized some install paths and added a bunch of --longopt synonyms for existing options that package builds use.Documentation: The help page generation logic (toybox help -av) now filter out invisible aliases and outputs "See command" for visible aliases, plus fixes for broken corner cases like nohup --help. The local git repo now has a simple index.html generated by a small shell script, linking to the git format-patch files for each commit, applicable via git am.
There was a bug report that specifying the cross compiler prefix twice includes the prefix twice (ala CROSS_COMPILE=prefix- CC=prefix-cc results in prefix-prefix-cc) which is what happens when you ask it to do that, yes. It's now better documented. (See also this kernel patch.)
Yi-Yo Chiang's losetup fix spawned an email thread where the android developers explained why Android doesn't (and can't) use devtmpfs. Rob forwarded a link to linux weekly news to see if he could get any attention from the kernel guys, but they didn't reply.
Huge as office blocks, silent as birds. They hung in the air exactly the same way that bricks don't.
- The Hitchhiker's Guide to the Galaxy
Toybox 0.8.8 (git commit) is out, with prebuilt static binaries and mkroot images bootable under QEMU (built using vanilla linux-5.19).
No new or promoted commands this time. (Time based releases mean NOT holding the release to wait for things like that.)
Thanks to Google for sponsoring the project's maintainer to focus on toybox for a while. (They want a hermetic build, I want Android to build under Android. Working on it...)
Features: The new timeout -i option kills a command for inactivity (output to stdout resets the timer). Basic support for tar --xform (but not yet the special tar-only s///x options). --long options now support unambigous abbrevations by default, so you can go "ls --col" and it'll figure out you mean --color. Added blkid -o understanding "full", "value", and "export" output formats. Added nsenter -C (cgroup namespace) and -a (enable all supported namespaces). Added mount -R and switched the bind mount default to be recursive (it still autodetects --bind and --loop mounts based on the source/target type, all --bind or --rbind do is switch the recursive flag on and off).
Elliott implemented tar --null, and taught file to recognize some Linux kernel images, and binaries for Linux's newly merged arch/loongarch (a mips64 variant from china).
Bugfixes: Several cleanups to taskset, mostly due to reviewing it before making an explainer video, but the review found an inappropriate use of TOYFLAG_STAYROOT that got fixed. Argument parsing for unshare and nsenter should now match debian's (I.E. "unshare -npu" works the same as "unshare -n -p -u" not "unshare --net=pu"). kill 1 no longer says "unknown pid 1: not permitted" (it says "bad pid" like everywhere else). test -x and friends now test live access, not permission bits. (Root ignores a lot of permissions, chmod u-x blocks you from executing your own file even if g+x and o+x should let you access it, things like selinux can further break the unix permission model, etc).
In lib/ a fencepost error in chomp() could read one byte past the start of the string, and xpclose_both() no longer closes the parent's stdin and stdout when they're explicitly passed through to the child. In scripts/runtest.sh, moving tests into subshells broke failure reporting with VERBOSE=all. While "make install" was creating directories when $PREFIX pointed to a nonexistent directory, "make toybox" didn't even though it tried to place the output file there.
James Farrell switched the test suite from detecting root via $UID to $(id -u). (It's not a security issue, this just controls which tests we attempt. It's another workaround for missing features in mksh.) Taolaw spotted that httpd could segfault when xabspath() returns NULL (for error conditions such as infinitely looping symlinks or "." not resolving when the current directory was deleted).
Documentation: We recorded the move from C99 to the C11 standard, which was actually made a while ago: the typecast constants we've been using for a while are a 2011 feature not available in the 1999 edition of the C standard. (This came up when we had to move to C11's "_Noreturn" to work around a compiler bug in llvm. Yes __attribute__((__noreturn__)) should be identical, that's the bug part.)
The website's nav bar got updated (among other things, linking to our youtube channel), and the FAQ entry on cross compiling got expanded. The toys/example commands moved from "make list" to "make list_example" (since they're not enabled in defconfig either). The cross compiling example command line in "make help" now sets LDFLAGS=--static instead of putting that in CFLAGS.
The web archive is back, and since the missing messages were never delivered (the mailserver trying to deliver them timed out and bounced them back after a couple days) this means unlike previous failures the web archive isn't out of sync with reality: the hole was the list actually being down until Dreamhost tech support figured out what they broke this time.
Pending: More work on toysh: case/esac was confused by nested flow control blocks, support for [[ < > =~ ]] tests, implemented the rest of the $((math)) operators and support for ((math)) tests and "for ((math;math;math))" loops, and so on. (The next toysh goal is to get the test suite running under mkroot, but other stuff keeps coming up.) James Farrell upgraded diff, adding three line format options and support for diffing FIFOs. Rob did several rounds of dd cleanup, then got distracted by diff cleanup which turned into a complete rewrite of diff. Neither was ready to promote in time for this release though (although the release got delayed almost a week before Rob admitted that).
Library: The lib/args.c command line parser now has two optional modifiers (" " and ";") for each argument type, providing 4 combinations (both unset, both set, one of each set), and all 4 now have defined semantics and tests/skeleton.test exercises them. (This was motivated by unshare needing a new combination to match the debian behavior.) lib/args.c also added "~" to collate bare longopts (so multiple bare longopts can be synonyms setting the same flag or argument variable).
New function xrunread() which launches a child function, writes a string to its stdin, and returns everything the child wrote to stdout as another string (or NULL if it couldn't run or exited with an error), leaving stderr alone (so it goes to the same place the parent's goes).
New functions same_file() and same_def_ino() to simplify file metadata comparisons. (If you're wondering why something so simple should have a function encapsulating the logic, this release also has at least 3 different bugfix commits for thinkos from switching all the commands over to use them instead of doing the test ourselves. All missing/extra ! or && vs || level stuff.)
The exit_signal() handler now blocks signals so sigatexit() won't re-enter the list when it receives two different killer signals. (Since xexit() capture uses siglongjmp() this should clean itself up when not actually exiting.)
Plumbing: Several warning suppressions due to things like llvm's fortify finding false positives, gcc's "int and long are identical on 32 bits!" warnings (yes... they are), the MacOS build being crotchety about vfork()... All verified non-issues at present.
The build plumbing now puts more effort into resolving dependencies and figuring out when stuff needs to be rebuilt. This includes noticing when the toolchain we're building with changes flags, and outputting a warning when it detects the need to run "make oldconfig" again. (At the moment calling kconfig/ from scripts/ would be a layering violation: I need to rewrite kconfig from scratch before it can do that automatically.).
Removed most compile time probes from scripts/genconfig.sh, replaced with things like #ifdef (_NR_syscall) and #if __has_include(<utmpx.h>), or acknowledging when a probe is a bug workaround for a specific libc version and testing for that instead, plus simply deleting some config options due to the 7 year horizon expiring so we can trust it to be there now.
Usual batch of musl workarounds for behavior that doesn't match glibc and bionic or where they've been arguing about stuff for years without actually fixing it. Ed Maste of FreeBSD added some FreeBSD checks/cases to lib/portability.[hc], mostly in places we already supported Apple or OpenBSD. The top level "configure" is now re-entrant (shouldn't append stuff to enviornment varibles like $CFLAGS twice when read twice). The MacOS defconfig now includes a lot more commands.
Test suite: The diff for failing tests is now output after the FAIL line instead of before, "make tests" now runs tar.test by default, a new skeleton.test uses toys/example/skeleton.c to exercise the lib/args.c command line parsing plumbing, scripts/runtest.sh now uses do_pass and do_fail consistently, and Rob keeps accidentally checking in bashisms and Elliott keeps submitting patches to remove them because android runs the tests under mksh and toysh isn't ready yet.
Work in progress to make TEST_HOST=1 pass on newer debian, which is a moving target. (The tests didn't change, but the behavior of the gnu utilities is not consistent. Or standardized. Or coherent. Or predictable. Or sane.) Some minor changes to commands like xxd and cmp to make their output look more like what debian's currently producing.
Making the tests pass on MacOS is harder: that calls group 0 "wheel" instead of "root" (so things like "tar.test" don't get the same result), stuff like "du" or "ls" often cares what filesystem you're mounted on (and MacOS hasn't even got the same ones _available_), and we even found a mac kernel bug where extending a sparse file sparsely allocates the previous length as actual zeroed disk space (ala "truncate -s 3m file; truncate -s 5m file; du file" says it's using 3 megabytes of disk space). There's probably more but that's where we stopped looking for now: since Rob doesn't have a mac to test on and the github tests don't reliably run when new commits are pushed (skipped when the servers are busy), fixing this hasn't been a priority. Lots of little red X in the github history because of this, though...
Mkroot: The output file names are now consistent across architectures: each root/$TARGET directory now contains an fs subdirectory with the expanded root filesystem, packaged into initramfs.cpio.gz, a linux-kernel built from linux-fullconfig which is built from linux-miniconfig, and a run-qemu.sh script to launch it under qemu. No more architecture name in the filenames (that's what the directory name is for), and no more "bzImage" or "vmlinux" depending on what filename the kernel build produced.
The fs/init script has better chroot support (not warning about /dev/shm and /dev/pts already existing). The airlock build no longer includes ftpd (you can use httpd and wget, scp out of dropbear, mount a network filesystem from the host, or if you really want to still use ftp can match ftpget and ftpput). When mkroot is downloading extra packages (for example in the dropbear build), it falls back to the host wget if it can't fetch with toybox's version. (This is because toybox hasn't got built-in https support yet, it's on the todo list.) Updated the dropbear build to the current version and fixed a compiler path issue. Fixed version skew in the workaround so the Linux kernel build doesn't require a third ELF package (but only for x86, not for any other architecture).
Sorry the mailing list has been down since the 19th, Dreamhost happened again. (First the web archive was empty, then it was down, then it was restored from a backup taken before the "upgrade" but was not updating with new messages, which they denied was an actual problem but now timeout bounce messages from all the attempts to send to it since it broke have started coming back saying a path doesn't exist on their server...)
Dreamhost tech support has been informed of the issue a half-dozen times, and did at least replace the "Currently there are no messages" page with a backup from before they broke it on the first day. Unfortunately they have yet to acknowledge anything else is wrong with it since then, and don't seem to have support staff working over the weekend. This used to be an annual event for them, but they hadn't done a truly major breakage in a while. I _think_ the 11 month gap that last link mentions is still missing, but the server's down again (or at least timing out) so I can't check.
The mighty ships tore across the empty wastes of space and finally dived screaming on to the first planet they came across - which happened to be the Earth - where due to a terrible miscalculation of scale the entire battle fleet was accidentally swallowed by a small dog.
- The Hitchhiker's Guide to the Galaxy
Toybox 0.8.7 (git commit) is out, with prebuilt static binaries and mkroot images bootable under QEMU (using vanilla linux-5.17).
Rob also uploaded the prebuilt binary cross and native compilers used to build those mkroot images (there's a README in there), and started producing tutorial videos explaining the toybox commands, their implementation, toybox's infrastructure...
The commands host, wget, openvt, and deallocvt were cleaned up and promoted. Elliott contributed the new commands uclampset, gpiodetect, gpioinfo, gpioiget, gpiofind, and gpioset, and Rob wrote a simple httpd (largely to give wget.test something to talk to).
One command was removed: catv didn't really serve a purpose (everybody just uses cat -v).
Features: top can now move the list with the LEFT/RIGHT cursor keys (changing the sort field is now SHIFT LEFT/RIGHT). Added find -samefile, cmp -n (and wired up skip1 skip2), tar --strip components (and tar --owner and --group can now specify :UID and :GID making tar.test more portable), lsusb and lspci now read /etc/{usb,pci}.ids[.gz] (when available) to provide human readable device descriptions, ifconfig can now rename interfaces. Moritz Weber added wget post support for form data. In toysh, cd got updated ("cd -" jumps to $OLDPWD, and cd can now handle deleted directories).
Bugfixes: cp --preserve xattr,context work together now, and Dario Freni fixed cp --xattr to avoid copying selinux context. The sort -u option now implies -s, wget -O - now writes to stdout, pwget -B removes more characters other implementations don't emit, time's realtime output was not properly zero padding the fractional part, and sed now works with multiple w to the same file. Fixed nl -E, realpath -e, find -newerXY and @time.nanosecond parsing, Various sh (it handles ${X: -1:1} properly now, which is not the same as ${X:-1:1} because :- has special meaning). The hello command in the examples directory now wait for a keypress before exiting when run as PID 1 (because calling wait() returned "No child process" immediately.) The multiplexer's toybox command --help once again shows the command's help (not toybox --help). Elliott fixed a strip bug in the MacOS build, taught file not to be confused by ELF BSS sections but to otherwise detect more invalid ELF files, and fixed an xargs bug where stdin was inappropriately O_CLOEXEC. Github user hg42 reported a bug where tar was looping trying to remove ".." at the start of names.
Library: Taught flags.h to #define its own CLEANUP macros so switching FLAG() contexts requires fewer steps. When args.c is just enforcing max/min argument count but collecting no options, imply "?" so "command -123" isn't an unknown option. Moved lib/help.c into main.c (nothing else in lib/ had to rebuild when the config changes which commands are enabled). The remains of linestack.c were renamed utf8.c, and toys.h now includes sys/syscall.h so commands don't have to.
Yank things with only one remaining user: moved get_line() to patch.c, struct str_len to bc.c, and struct ptr_len to ps.c Removed tty_esc() and tty_jump() wrappers. Various cleanups to lib/password.c and lib/tty.c. Removed the PEDANTIC_ARGS config option which just set a macro that was never used, xsignal_all_killers() now takes SIG_DFL as the reset value instead of explicitly checking for NULL, chomp() now removes any number of trailing \r\n, and it's now safe to llist_pop(0) just like dlist_pop(0). LongPing Wei improved support for copy_file_range().
Build: If you don't set $PREFIX, make install now defaults to $PWD/install (which does not require root access to write to, and you can tar up your pile of symlinks from there). More command sub-options removed (NETCAT_LISTEN and CAT_V).
Some of the uglier scripts/make.sh plumbing moved into scripts/portability.sh (which should now be safe to source twice), and moved almost all config varible definitions to "configure" now. The new $GENDIR variable theoretically lets the "generated" directory live somewhere else (not very tested yet). Various tweaks to scripts/make.sh to try to avoid unnecessary rebuilds and library probes when toolchain and config haven't changed. Added -Wno-pointer-sign to $CFLAGS because passing an unsigned char * to a function that expects char * is not a problem.
The airlock install in scripts/install.sh had the $PENDING items sorted into "started" and "not started". Add git and bash to $PENDING (used out of $PATH by --version and the powerpc64le build, respectively).
Cleanup: Removed the lib/linestack.c plumbing (which was never finished and hadn't been touched in years). Merged lspci.c into lsusb.c (so they can share config file reading infrastructure), and merged chvt/deallocvt into openvt.c. Minor cleanups to ping, fsync, ionice, pmap, truncate, timeout, tty, factor, mount. Went through and replaced \033 with \e in strings (since clang supports it and \033 is just awkward). Added LL to constant 0 in the FLAG macros to prevent gcc from warning that 0<<32 might produce 0. Moved llvm's -Wno-string-plus-int into configure instead of probing for it, since gcc no longer dies when asked to suppress an unknown warning.
mkroot: the ANSI escape to undo QEMU's wordwrap bug is now in both the init script and launch wrapper script (so wordwrap isn't broken while running the emulated system, nor if the emulated system fails to run). If devtmpfs was already mounted on /dev, we still need to create dev/pts. The init script now includes the linux kernel bug workaround to enable ping support. The armv7 target enabled CONFIG_ARM_LPAE in the kernel to work around around a QEMU bug that's gone unfixed for 4 years. Enable network support in m68k target. The mcm-buildall.sh script got some minor updates, and the resulting cross and native compiler binaries are now downloadable so you don't have to run the build if you don't want to.
Docs: "toybox --help" no longer says "see toybox --help". There's an ANSI escape cheat sheet at the start of lib/tty.c. Reworded some command directory READMEs, and tweaked menuconfig display. Converted www/doc/mount.html and www/doc/ext2.html from text to html. Freshened up design.html a little (and fixed some typos pointed out by Peter Ennis). Replaced the git internals video URL in roadmap.html with a different performance of the same talk that hasn't been made private. Added the kconfig-language.txt from Linux-2.6.12 to the kconfig/ directory.
Busy? We'll I've just got this bulldozer to lie in front of or otherwise it'll knock my house down but otherwise no, not especially, why?
- The Hitchhiker's Guide to the Galaxy
Toybox 0.8.6 (git commit) is out, with prebuilt static binaries and mkroot images bootable under QEMU (using vanilla linux-5.15).
Make root: The system builder got upgraded, with better logging and layout of the output directory, plus scripts/mkroot.sh should be easier to read and understand now. (Also added basic support for the qualcomm hexagon, although it just builds a chroot filesystem, you can't boot a hexagon kernel under qemu quite yet.)
New commands: Rob added linux32. Dan Brown added sha256sum (and the related 224/384/512 variants). In pending, Elliott contributed strace and Moritz Röhrich contributed hexdump.
Features: Elliott added date -s, pmap -p, tail -F -s, kill -0, reboot/halt/poweroff -d, taught file to recognize Mach-o universal binaries, made Android's log take input from stdin when it has no arguments, added tail --bytes --lines (the --long synonyms for -c and -n), added i2cdetect -q, taught i2cdump to write XX for read failures, made timeout use the monotonic clock, and modernized the output of uptime.
Rob added find -quit -lname -ilname and -d as a synonym for -depth, taught cut -d $'\n' to cut by line and added posix cut -nb (which wraps to the start of -c utf8 characters), added cpio --ignore-devno --renumber-inodes, taught cal to use 3 arguments (day month year), added tar --selinux support and a "had errors" message at the end, made uname -o say "Toybox", and fixed the grep -Fw combination (used by the 64 bit powerpc kernel build).
Ella-0 added split -n. Peter Collingbourne added grep -L.
Outside world: The 0BSD license is now part of the ISO-5962 standard. Of the currently 38k 0BSD licensed projects on github toybox isn't even the most popular, it's fourth.
Elliott asked that toybox's cut -DF feature (a cheaper alternative to awk '{print $3}' be supported by other packages so it might someday make it into posix, so Rob submitted it to busybox where it was eventually merged.
Added a local git mirror for those reluctant to trust Microsoft Github.
In the web nav bar, our freenode channel moved to libera.chat (like everyone else's; there was a certain amount of drama involved).
Pending: lots more work on toysh: it has basic $((math)) support now, += assignment, the "declare" command and corresponding variable types (declare -i, declare -u, etc), several bugfixes, greatly improved support for background processes on NOMMU systems, and a bunch more sh.test entries.
Elliott fixed modprobe's parsing of short lines. Rob fixed a division by zero error when vi tries to edit a zero length file. Anqi Dong made sure that syslogd messages sent to sockets end with a newline. Eric Molitor significantly upgrade wget with http 1.1, chunked encoding, and (external library) https (TLS 1.2) support, plus several bugfixes. Michael Hope fixed tftpd's option parsing.
Documentation: The roadmap.html and status.html pages got noticeable updates. (status.html is now directly generated by scripts/mkstatus.py, the old status.html wrapper that server-side-included status.gen has been removed). The design page provides better links to the LP64 documentation, and the code page explains a corner case where the filename and first command name expect to match (and how to work around it if they don't). Some website files weren't in the repository: two jpegs linked from html files, and the www/.htaccess file that triggers the server side includes in the navigation menu is now checked in. Johannes Schmitz fixed a typo in about.html.
The shred usage line now includes all options. The logwrapper command now warns when it isn't built standalone. The help command no longer shows a header line about toybox unless it's called with no arguments. (It still shows it for command --help.) The --help option no longer needs to be the first option, and is checked before the "Not root" error message for restricted commands.
Bugfixes: Elliott made ps exit with status 1 if no processes were shown (for LTP), fixed an off-by-one in dmesg and a bounds check in netstat, fixed pidof -s, and taught rmmod to handle multiple arguments. Denys Vlasenko pointed out that free -t is "total" not "terabytes". Samanta Navarro pointed out a leftover 32 bit limitation in argument groups. Mikhail Kashkarov fixed mkdir's error handling for existing directories without -p. Rob fixed the 32 bit readelf build on Android, fixed a race condition in tar leading to the occasional spurious archiver warning, changed cp to work around a posix violation in the kernel, made xparsedate() handle more whitespace and ignore trailing + or - (a NOP timezone), made su log the right username, switched getuid() checks to geteuid() in df and ping, fixed a place in the test suite where do_test() could get confused by symlinks in the $PATH (calling realpath too early and losing the name of the command being run), made env -i use the old $PATH to run its command, and made grep --color highlight all matches.
Worked around a bug in glibc+gcc 9.3 where linking against librt.a (for things like timer_create()) pulls in libgcc_eh.a which uses threads, meaning you can't statically link against librt.a from a non-threaded app. (I hadn't noticed because it works fine with the musl and llvm/bionic toolchains, only fails statically linking on e.g. debian.) The kernel fix for the cpio encrypted filesystem issue worked around in 0.8.5 made it in. Similarly, the FS_IOC_{GET,SET}{VERSION,FLAGS} ioctl family are historically broken (taking an unsigned int argument while advertising signed long), which we fixed and reported upstream to a long round of bikeshedding (sadly the result seems to have been the man page maintainer giving up on documenting ioctls at all.
Cleanups: cut switched to FLAG() macros and no longer allows -f with -F, eject uses FLAG() macros and the linux/eject.h header, prettycool@protonmail added tabs to time's output, and Rob removed the floating point dependency from time. Minor cleanups to lsattr, lspci, nsenter, xxd, file, insmod, modprobe, arp, bootchartd, pmap, comm, lsof, blkid, crond, init, userdel, makedevs, and scripts/make.sh. The "int fd = fd;" initialization hack to shut up gcc's "may be used uninitalized, but isn't" false positive warning has been replaced by a QUIET macro that resolves to nothing on llvm (which doesn't have the gcc bug). Ryan Pritchard reported a bug where alias ls="ls --color" would prevent --help or --version from being the first argument to the command, which was a pain to fix without breaking things like echo -- --version and basename -s --help file--help. (Both toy_singleinit() in main.c _and_ get_optflags() in lib/args.c now check for those.)
Infrastructure: xabspath() now has a more granular (flag based) control interface.
scripts/make.sh now uses wait -n (available since bash 4.3 in February 2014) to keep the processors busier during a parallel build. Tests are now running in a subshell, which means functions and local variables defined in one don't pollute others during "make tests".
Guo Chuang reported that lsattr won't build on an 8 year old version of centos, which is still supported for 2 more years because Red Hat can be paid to have a 10 year support horizon, longer than toybox's 7. Rob fixed it (and merged a similarly ancient compilation failure fix when building pending/ip.c against a 3.10 kernel), but the philosophal argument remains unresolved.
Standalone builds can now override the .config file location with KCONFIG_CONFIG same as the multiplexer build. scripts/single.sh can now cope with a missing .config file (it uses the defconfig values for the CONFIG_TOYBOX_* global symbols). "make install_airlock" no longer needs host versions of sha256sum and sha512sum.
In the test suite, VERBOSE=spam now shows expands successful tests like it would for errors.
scripts/record-commands got updated and logwrapper got renamed logpath.
It was of course a descendant of these eccentric poets who invented the spurious tales of impending doom which enabled the people of Golgafrincham to rid themselves of the useless third of their population. The other two-thirds stayed firmly at home and lived full, rich and happy lives until they were all suddenly wiped out by a virulent disease contracted from a dirty telephone.
- The Hitchhiker's Guide to the Galaxy
Toybox 0.8.5 (git commit) is out, with prebuilt static binaries and mkroot images bootable under QEMU (using vanilla linux-5.12, except that s390 needed another perl removal patch).
This development cycle had thirty commits to sh.c fixing bugs and adding features to toysh. Shell functions and local variables are now implemented, along with the "set" builtin and trace support, and job control is about halfway in. The shell as a whole is maybe 80% done, but still has some obvious gaps like $((math)) and interactive command line history/editing, plus a bunch of testing.
New commands: Moritz Röhrich added pwgen and base32, and Elliott Hughes added unicode. The readelf command got promoted out of pending, and sha3sum is now switched on in defconfig.
Michael Christensen added chsh to pending, which hasn't been promoted yet because it's part of a group of commands (useradd, userdel, groupadd, groupdel) that should all be promoted together at some point (and depend on lib/passwd.c, which could use some more work).
Upgrades: cpio now supports extracting multiple concatenated archives. file now recognizes android's new XML binary format. devmem now works on nommu, can handle 0x prefxes on the address, and prints hex or decimal output to match the address type. df -a now shows overmounted filesystems. test -k checks the sticky bit. Added -t to install, cp, and mv, and -u to cp and cpio. find -executable checks that _we_ can execute them (u+x could be owned by a different user or have selinux weirdness).
Elliott added several features to date (--iso, %:z output format, and --utc as a synonym for -u), added a sed s///x option, added units to ulimit output, and made several UI changes to hexedit including a color mode (which is now the default, press x to toggle between old and new display), masked out the file type in chmod error messages and taught it to handle complex modes (like u+s+s), hardened file and readelf against invalid input, added a portability.h workaround for macos statvfs for df, enabled line buffering in echo and yes, and significatly sped up tr. Rob similarly optimized seq and count.
make tests now defaults to VERBOSE=fail (and now has VERBOSE=all to continue after failure, and VERBOSE=quiet to show FAIL: lines without diff -u output). Cleanups to tee, netstat, file, and df. Added "static" annotations in a lot of commands, made more things use FLAG() macros. Ethan Sommer pointed out an unnecessary wrapper functio