[Toybox] [PATCH] Implement mv -n / cp -n (no clobber).
Andy Chu
andychup at gmail.com
Fri Apr 15 12:40:00 PDT 2016
On Fri, Apr 15, 2016 at 10:16 AM, enh <enh at google.com> wrote:
> things to avoid/reasons why i'd happily get rid of mksh in Android:
OK interesting -- can you say more about the use cases of shell and
toybox in Android?
For example, why does Android need toybox expr? Does some shell
script use it? I only know a little about Android (from building AOSP
18 months ago), but my impression was that the use of shell scripts
was limited, and they were all "in-tree" so you can patch them.
So if you had some upstream packages that used shell for an init
script or something, you could patch it to use $(()) in mksh instead
of expr, and avoid expr. Or maybe it's just not worth the effort to
do that, and it's easier to have expr on there. (I thought I was the
only one who used expr :) )
Who uses the shell? I would have guessed it's for the boot process
mainly? I don't think people are installing compilers on Android
phones and building GNU packages, but I could be mistaken. And I
would think the main use cases right now for toybox are on the device,
not for platform and NDK builds, no? But maybe it is useful for build
with toybox to make the build hermetic. I know all the compilers are
vendored in.
I imagine the big users now are not end users or app developers, but
platform developers (e.g. Samsung engineers) who need to tweak things
when bringing up the OS on new hardware. I'm able to run toybox on my
Nexus 5x via ConnectBot, though honestly I'm not sure what to do with
it since it's limited to an individual app UID :)
I think it would be cool to have my shell on Android, and it's written
in Google-style C++ like Ninja like I said, with unit tests, no
globals and (tasteful) dependency injection and everything. It's only
2 weeks of work and 2800 lines of code now, so that's a long ways off
:)
But I'm curious about the use cases. I think I can probably get some
other shell users at Google to contribute, because I've done a lot of
the hard parts in a clean way. Lexing and parsing shell are
particularly hard IMO; compare with mksh's yylex() and associated
macros in lex.c, which is about 1000 lines in a single function, and
it only does part of the job my lexer does.
thanks,
Andy
1460749200.0
More information about the Toybox
mailing list