[Toybox] Checking in...
Rob Landley
rob at landley.net
Wed Mar 19 20:15:36 PDT 2025
Sorry for the radio silence, I've been in tokyo all month, and haven't
spent a lot of time sitting at my laptop. (The really bad stomach bug
over the weekend didn't help.)
I try not to have large gaps in development but when life happens I can
get distracted. In theory I fly back on the 27th and should be able to
shovel out pending items then. What was I in the middle of...
I owe Tim Bird a fix for his toysh bug, it just got tangled up in making
"alias" support work properly which is a sequencing issue. The current
processing is doing things in an order that makes it non-obvious where
to insert stuff, and I haven't had time to sit down and reorder things
and then retest it all. (Note to self: aliases also tab complete.)
$ alias potato='echo hello >'
$ potato outfile
$ cat outfile
hello
$ potato
bash: syntax error near unexpected token `newline'
$ alias potato='echo ${VAR:='
$ potato thursday}
thursday
$ echo $VAR
thursday
$ potato
>
Yes, alias processing affects LINE CONTINUATION. However...
$ POTATO=potato
$ $POTATO
bash: potato: command not found
It happens after variable expansion but before redirection, except I'm
doing both of those in the same pass, so...?
Speaking of "alias", the (most recent) request for nologin came with a
request for "pagesize" but there's already "getconf PAGESIZE", and while
I could add a command alias in getconf.c this really seems like it
should be a shell wrapper or something? (You can already do it, you just
want a different UI.) Long ago I had a wrappers subdirectory and then
decided that was a bad idea (ala commit 918de13c86a5) because a
central-ish design idea is the project is a single self-contained
executable: you can plonk a statically linked toybox file onto a system
and build a whole chroot around if you like. You only have to audit ONE
BINARY.
I recently noticed that busybox did some sort of internal cache thing to
store shell snippets as commands, which seems overcomplicated, and
thought maybe instead I could foist this on mkroot, ala:
$ cat mkroot/packages/wrap
#!/bin/echo Try "mkroot/mkroot.sh $(basename $0)"
# Shell wrappers for various things toybox already does
xp() { local CMD="$ROOT"/bin/$1; shift; printf "$@" > "$CMD"; chmod
+X "$CMD";}
xp pagesize '#!/bin/sh\n\ngetconf PAGESIZE\n'
And then add "wrap" to the mkroot command line and it'd run that extra
build to add shell wrappers to the new environment? Or you could run it
yourself as part of an install ala:
ROOT="$PWD" bash mkroot/packages/wrap
Anyway, that seems like a better solution, so now the question is
whether "nologin" should stay a command, and is anything else properly a
wrapper?
Or should this be a default "alias" list instead of wrappers, so once
I've added alias support to toysh I can put a default /etc/profile in
mkroot that adds these commands as aliases? Except NONE of these options
would have --help text or an easy way to list available commands in one
place. (Do aliases tab complete on the command line? Yes they do.)
And that's the point I stepped back and went "I need to think about this
at a design level" and never got back to it because tokyo is absorbing
my attention...
I also got pointed at a public domain blake3 implementation
(https://github.com/michaelforney/BLAKE3-tiny) which I did a quick
cleanup pass over on the flight to tokyo, and was looking to plonk into
lib/hash.c but hash_by_name() on the openssl codepath (line 35-ish) has
magic name lookups a macro translates into MD5_Init and
SHA512_DIGEST_LENGTH and so on which it expects to get out of the
library, and I'm not finding blake3 versions of these _in_ the library?
I suppose I can make the blake3 support be non-library only via config
symbols. (No, I haven't done blake2 yet. No, I dunno what the
$1$salt$passhash symbol for this hash would be either, ala the crypt(5)
conversion I also need to finish for next release. And toys/*/sha3sum.c
is still separate, and putting ALL that into hash.c is a big ugly, maybe
I should break up hash.c into hash-sha3.c and so on, and then
lib/crypt.c or something for the dispatch code...? Design decisions I
need to pace and stare at the ceiling for, and walking around tokyo is
WAY too distracting for that. So many vending machines! And combini. And
little restaurants. It would be nice if I could talk to the _people_ but
8 years of reasonably seriously trying to learn the language (including
two semester long actual show up and sit down classes on it) and I can
just about navigate buying stuff at the grocery store because it's
always the same question ("do you want a bag").)
Alas, ublock is still broken. Nobody's upvoted the gitlab issue,
possibly because gitlab's website has a "free trial" button instead of
"create an account". I may have an ancient account back in minneapolis,
but if so it's not recorded on this laptop. Having to pay to get off a
spam block list would be annoying. (And then there's working up the
chain: I talked dreamhost down last year. Now I need to talk ublock down
(THEM copying the string from ME does not mean I am infected with THEIR
thing, and it's MY LAST NAME.) Presumably I would then talk this german
"spamhous" thing _they_ got it from down? Because of course their
mistake is my problem. Oh well, deal with this _after_ all the
international travel...)
There's plenty of other stuff, but that's off the top of my head.
Pascal's apology and all. (He was sorry he'd written a long letter
because he didn't have time to write a short one.)
Not dead, just distracted. Sorry for dropping out of touch...
Rob
P.S. I've blogged about some of this, in fact the past couple times I
looked at the list and went "ooh, I've been too quiet" I started writing
an email and then went "this is properly a blog entry" and moved it
there. But I'm MONTHS behind editing and uploading my blog, and if you
use ublock you still won't be able to see it anyway, so. 15 minute
snippets of available time are not condusive to publicly publishing a
finished output.
More information about the Toybox
mailing list