[Toybox] [PATCH] Implement mv -n / cp -n (no clobber).

dmccunney dennis.mccunney at gmail.com
Sun Mar 27 13:36:39 PDT 2016


On Sun, Mar 27, 2016 at 2:25 PM, Andy Chu <andychup at gmail.com> wrote:
> Sure I could just go change coreutils and bash ... I've been puzzling
> through the bash source code and considering that.

<gack>

> bash is like 175K+ lines of code, and If you wanted to support all of
> it, I think you would end up with at least 50K LOC in the shell...
> which is almost the size of everything in toybox to date.  If on the
> other hand you want a reasonable and compatible shell, rather than an
> "extremely compatible" shell, it would probably be a lot less code...
> hopefully less than 20K LOC (busybox ash is a 13K LOC IIRC, but it's
> probably too bare)

I started on Unix System V R2, where the default shell installed as
/bin/sh was the Bourne shell *before* it acquired shell functions.  I
used csh for a while as a better interactive environment, but didn't
try to write scripts in it.  Then I discovered the Korn shell, and as
soon as it reached the point where it could successfully be installed
as /bin/sh, I did so on any machine I administered.

I had a Unix machine before I got an MSDOS PC, and spent time trying
to make the PC look as much like Unix as possible.  The big win was
finding the MKS Toolkit, which had DOS versions of every Unix command
that made sense on a single-user, single tasking OS.  The Toolkit
included a complete Korn shell replica that did everything save
asynchronous background tasks.  When I was in the Korn shell
environment, you had to dig to discover you *weren't* on a Unix box.
:-)

When I encountered bash, I thought "Oh, wonderful.  The FSF has
decided to make bash include *everything* from *all* other shells.
The result is a bloated mess."

I have it under Linux, and Windows courtesy of a git implementation,
and Android.

I don't know what Rob's intent is when he can finally get to toysh,
but I'd be delighted with something that looked and acted like ksh.  I
see no point to re-implementing the wheel by making a bash clone.  If
the Android user really needs bash, they can install a third party
port.

I have busybox on a quirky Linux system, and went through and replaced
the busybox commands with full versions from Ubuntu, because I wanted
full versions and not cut down subsets.  Thus far, Rob seems to be
implementing toybox commands that *are* full versions supporting all
of the features of the stand alone versions, but still dramatically
reducing code size and rationalizing the design, so when Toybox hits
an actual 1.0 release, I won't feel a need to substitute stand alone
versions.

As far as I can tell, it will be possible to have a working Linux CLI
system with no GPL code save the kernel.   I am *all* in favor.
______
Dennis
https://plus.google.com/u/0/105128793974319004519

 1459110999.0


More information about the Toybox mailing list