[Aboriginal] Aboriginal Digest, Vol 27, Issue 7

Rob Landley rob at landley.net
Wed Apr 17 11:46:55 PDT 2013

On 04/15/2013 11:50:36 PM, Isaac Dunham wrote:
> On Mon, 15 Apr 2013 13:30:35 -0700
> aboriginal-request at lists.landley.net wrote:
> > Hello
> > I am struck in package shadow as it needs chmod -f. However chmod -f
> > isn't yet implemented in toybox. So I just pushed it above in
> Hmm...looks like it should be trivial to implement. In fact, it  
> half-works to just make it a no-op:
> +USE_CHMOD(NEWTOY(chmod, "<2?vRf", TOYFLAG_BIN))
> But for a full implementation, it would also take a few lines added  
> to verror_msg or whatever is calling it...
> one way that crosses my mind is to:
> -add a variable (int toyquiet; in lib.h ?)
> -set it conditionally:
> toyquiet = (toys.optflags & FLAG_f);
> -wrap everything in verror_msg() before the last line with an
> if (!toyquiet) {
> ..
> }

if (toys.optflags & FLAG_f) {
   open("/dev/null", O_RDWR);

(This assumes that stdin and stdout exist, but if we're called out of  
spec we at least won't make things too much worse...)

> > baseconfig-busybox. However, it still had the same issue. On further
> > search, I found that busybox is building chmod but toybox is
> > overwriting it.
> > Then it dawned that toybox doesn't parse baseconfig-busybox but  
> rather
> > does defconfig.
> What about switching install order (if someone enables something in  
> busybox,
> it becomes the default)?

I've thought of installing busybox in one directory and toybox in  
another and having the $PATH fall back between them, but busybox is  
going away. Toybox is replacing busybox. So the extra plumbing would  
just be transitional.

build/host/busybox currently says:

Currently defined functions:
	[, [[, ash, awk, bunzip2, bzcat, bzip2, cpio, dd, diff, egrep,  
	fgrep, find, ftpd, ftpget, ftpput, grep, gunzip, gzip,  
ifconfig, init,
	install, less, lspci, man, mount, mv, pgrep, ping, pkill, ps,  
	sed, sh, split, stat, tar, test, tr, umount, unxz, vi, wget,  

vi and less need the same line editing code as the shell command  
history, otherwise reasonably straightforward.

grep/egrep/fgrep are mostly just regex code wrappers, I should do that.

find is simple now that dirtree is there (and there's a version checked  
in awaiting cleanup).

init shouldn't be there, aboriginal uses oneit instead.

There's a stat in pending, needs cleanup. Same for ifconfig.

ps, pgrep, and pkill are actually easy, I just haven't done it yet. :)

lspci is easy. install is easy. split and tr are easy.

tar is a bit fiddly, but not too bad.

ftpd, ftpget, ftpput, and wget are all straightforward but networking  
code. (Haven't done most of the networking code yet, other than netcat.)

ping and route are different kind of networking code (similar to  

sed I wrote the busybox version of and have started a toybox version of.

mv is on my short-term todo list, now that I've got cp and rm it's  
pretty much "more of the same".

mount/umount I started and got interrupted, need to get back to it.

bunzip2 and bzcat I have the plumbing for already implemented (just  
needs polishing), but the problem is busybox won't support -j unless  
it's built in. So they (and zcat, and xzcat) stay until I implement tar  
in toybox.

gzip/gunzip there's nice public domain versions of (I have the links  
around here somewhere), and if nothing else I ported it to java 1.0  
back in the 90's.

xzcat/unxz has a version checked in, awaiting cleanup. (The compression  
side is a todo but the code's public domain and I can clean it up.)

cpio and tar are fairly straightforward, on my todo list.

bzip2 is kind of horrible but I have code here. (The string sorting  
gorp even I haven't figured out how to simplify...)

I keep thinking I've already implemented dd. It's fairly  
straightforward, just has a lot of funky command line option parsing.

For diff I want to use Bram cohen's algorithm

man is a design issue: not sure what it _should_ do. A trivial zcat of  
preformatted text is trivial, it should integrate with the "help"  
command somehow. (help documents shell builtins, man documents stuff  
installed in $PATH, for toybox both are builtin but man should also  
check $PATH for external commands. But _not_ the horrible troff crap.)

ash and sh are a biggish deal, I've got a lot of research for that but  
need a couple months to do it right. expr is basically the $((blah))  
shell builtin. [, [[, and test are all the same command, which I've  
started a local implementation of.

awk is a biggish deal.

So I have plans for everything on the list, I just need a lot more  
time. I'm actually cheating slightly answering this email in a tech  
talk about some new vendor technology I don't think I'll have to care  
about but can't conveniently leave without stepping in front of the  
camera recording the presentation.


More information about the Aboriginal mailing list