[Toybox] New tests for dirname and wc
Rob Landley
rob at landley.net
Sun Oct 28 11:04:23 PDT 2012
On 10/27/2012 05:22:52 PM, Felix Janda wrote:
> Hello,
>
> attached are some simple tests for dirname and wc and
> a fix for a small typo in another test script.
Cool.
> Posix specifies an -m option for wc, which toybox does
> not implement. Should there be a test for this, too?
That's internationalization support, which I haven't implemented yet.
I think toybox should support utf-8, but am not as interested in
multiple translations and date formats and such. (Those belong at the
GUI/X11 level.)
> Why do the scripts actually use bash?
The tl;dr version is "dash was a mistake on Ubuntu's part".
The long version is that Linux was literally created to run Bash. Linux
evolved out of a terminal program that Linus wrote in i386 assembly
language (booting on the bare metal, from a floppy disk) because the OS
he was using (Minix) couldn't keep up with a 2400 baud modem and he
wanted to dial in to the university unix machine to read usenet message
boards. He added the ability to read and write the minix filesystem so
his term program could download files from usenet, and then he added
the system calls necessary for it to run bash so he didn't have to boot
back into minix to run "rm" and "mkdir" and such between downloads.
(This is all in Linus's biography "Just for Fun", by the way.)
Bash was the first program Linux ever ran, and Bash remained the
standard Linux shell on all Linux distros until Ubuntu made the single
dumbest technical decision in its history. In Ubuntu 6.10, they
redirected #!/bin/sh to point to dash instead of bash, because "the
boot was too slow".
Yes, really: https://wiki.ubuntu.com/DashAsBinSh
Rather than modify the boot scripts to say #!/bin/bash at the top (a
change which was deemed 'too intrusive'), they changed the system
default shell. This broke all sorts of stuff (such as the kernel
build), but Ubuntu was the dominant distro at the time and could force
the change down people's throats.
Note: Ubuntu didn't _stop_ installing bash by default. Bash was still
there. They just added a second shell and redirected /bin/sh to point
to that. So bash is still there if you say #!/bin/bash.
The Ubuntu developers then realized that it hadn't fixed the boot speed
problem, and switched from system V init to upstart to get better
parallelism, something they should have done in the first place and
which rendered the change in #!/bin/sh moot. (Red Hat switched to
systemd instead, and they've been fighting over it ever since. Upstart
probably would have been able to shout down systemd if Ubuntu hadn't
convinced everybody it had horrible technical judgement with dash.)
Meanwhile, dash doesn't support path/{file1,file2} syntax, it doesn't
support
"diff -u <(sort -u file1) <(sort -u file2)", and so on. Last I checked
it didn't even support "set -o pipefail" which ksh and ash and such
have supported for years.
Toybox's built in shell is not attempting to duplicate dash. It's doing
a posix shell and then adding the bash extensions that make sense.
Rob
More information about the Toybox
mailing list