[Aboriginal] Replacing bash with mksh

Rob Landley rob at landley.net
Wed Jun 12 22:02:18 PDT 2013

On 06/12/2013 01:24:42 AM, Isaac wrote:
> On Mon, Jun 10, 2013 at 08:51:07PM -0700,  
> aboriginal-request at lists.landley.net wrote:
> > From: Rob Landley <rob at landley.net>
> > On 06/10/2013 02:33:06 AM, idunham at lavabit.com wrote:
> > > On Sat, Jun 08, 2013 at 02:00:49AM -0500, Rob Landley wrote:
> > > So there are now four versions of mount floating around, none of  
> which
> > > are publicly available?
> >
> > I think a couple got posted to the mailing list? (People keep  
> emailing
> > me off list. Dunno why. The most recent is attached, the previous  
> one
> > was... october I think?)
> Ah, it was before I subscribed.

Even though this project got relaunched in 2006 or so, I've been  
trimming this bonsai since about 2001. Random snapshot of the previous  
version's in (http://landley.net/aboriginal/old and yes there was a  
version before _that_...)

These days toybox is taking up most of my time, and the multiple out of  
tree mounts are actually a toybox issue...

> > Plus klibc has one, android toolbox has one...
> > Last time I sat down to write mount, it used loopback stuff first  
> so I
> > had to write a proper losetup (which I did, although that had grown  
> a
> > lot of new features since last I'd checked). Then I started  
> researching
> > all the new mount flags, and I have a stub that can enumerate them  
> and
> > print out help text for them (also attached). The "actually does
> > something useful" variant trails off in the middle and does not
> > currently compile...
> Also there's this one:
> http://lists.landley.net/pipermail/toybox-landley.net/2012-November/000691.html
> Which is not a full mount, by any stretch of the imagination.

A simple mount on the level of what toolbox does is fifteen minutes  
work. Doing it _right_ is a weekend. Probably not _this_ weekend since  
I'm visiting my sister, and probably not _next_ weekend since my wife's  
in town for a convention (4th street). last weekend I visited my sister  
and the niecephews. The weekend before that I think I was in Austin...

Today I've bisected the mips regression:

And am poking at sh4. Also poking at p9d (a 9p server I'm adding for  
fun), and catching up on email, and catching up on the daily show. And  
all that's because I haven't go the brainpower right now to handle the  
next round of ifconfig cleanup.

> > Also, keep in mind that I did several months digging into the guts  
> of
> > NFS back in 2010 and would like to use the new string interface  
> instead
> > of the old binary interface:
> >
> >    http://landley.livejournal.com/52663.html
> >
> > Basically all the "smbmount" and "nfsmount" and such front-ends are
> > doing three things:
> <sniP>
> > I.E. if you know what you're doing you can do an NFS or samba mount
> > from a mount command that doesn't know anything special about that
> > filesystem. (But if the command DOES know about it, it can intercept
> > what you actually said and screw it up.)
> >
> > Having large amounts of extra code for this is silly...
> Which is ~ 1/2 or more of the large version...

I feel bad that people are waiting for this, but I'm already  
overwhelmed with todo stuff in pending. All I've really done in the  
past month is cleanup, and I'm nowhere near caught up. (Largely because  
I have maybe 5 hours of work a week to put into this, and it's mostly  
in twenty minute chunks.)

> > > I'd write a test for it if I could figure out how to do one that
> > > works with
> > > all Linux hosts...but the corner cases it makes sense to check may
> > > not be
> > > present on many systems.
> >
> > I don't understand. Care to explain?
> The tests that could be done would depend on having certain  
> uncompressed
> modules (since we don't yet support compressed modules...) present to  
> check
> results against.
> *Not every system even has kernel modules present/supports modules
> *Anything that can be a module can be disabled
> *It's possible to disable anything that uses firmware.
> Of course now that I'm writing this I test and see that multiple  
> modules
> should be supported, but aren't; expect a test and a patch sometime  
> soon.

The kernel's I've been building for aboriginal don't actually have  
module support switched on. It's easy enough to add, I just haven't  
done it because this way there's no boot sequencing issues or strong  
version dependencies between the root filesystem and the kernel.

> As far as supporting compressed modules goes...
> It could probably be done via a hook in lib/*.c (xdecompress?) which  
> will
> -use magic numbers (NOT extensions, we may want support for  
> autodetecting
>  file format of streams for tar...) to identify the format <A>
>  (about 6 bytes should be enough:
> BZh bzip2,
> { 0xFD, '7', 'z', 'X', 'Z', 0x00 } xz,
> 1F 8B 08 gz,
> ..)

The "file" command is one I'd like to implement but the magic is a  
GIANT list of file types in a big datafile, and toybox is a single  
portable binary you can statically link. Possibly I could pick a couple  
dozen of the most common file types (elf, gzip, png/jpeg/gif, ascii)  
and have it check for those? Dunno...

> -fork <A>cat with the file/stream as input and the toy then reads the
> output stream

An insmod that takes a module from stdin shouldn't be too hard. We've  
already got "-" logic for that really...

> > > > I grabbed the original massively stale version from 1999, on the
> > > > theory there's probably less of it to read. "wc -l *.c" says the
> > > > total is 27180 lines, which is a couple solid days triaging  
> right
> > > > there.
> > >
> > > 23460 for ksh-openbsd, patches applied.
> > > So someone has achieved negative code growth.
> >
> > Yay?
> >
> > Is it still public domain?
> Yes, except for alloc.c, mknod.c, and strl{cpy,cat}.c, which are  
> 3-clause
>  (or less) BSD, and posix_signals.h, which apparently is still  
> 4-clause BSD.
> Of those, alloc.c is the only one that would be relevant.

That's just fiddly enough that at midnight on a wednesday with work in  
9 hours, I'm not feeling hugely like adding it to the todo list...


More information about the Aboriginal mailing list