[Toybox] patch: add built-in versions of sha-2 family hash functions
Rob Landley
rob at landley.net
Fri Jun 4 23:10:49 PDT 2021
On 6/4/21 8:22 AM, Dan Brown wrote:
> Hi Rob- thanks. I get the impression that I would not be able to help on the
> things you're working on - they sound like they involve knowledge that is too
> deep for me to learn for a side project.
That's just what _I'm_ working on. The project has plenty of surface area. Let's
see...
If somebody wanted to write an awk, I'd thank that person profusely. Android
uses kernighan's original awk:
https://en.wikipedia.org/wiki/AWK#Versions_and_implementations
But it uses a bespoke bsd license variant
(https://github.com/onetrueawk/awk/blob/master/LICENSE) and toybox uses a public
domain equivalent license, so I can't take code directly from that. Plus I'm
told it doesn't support utf8:
https://github.com/landley/toybox/issues/67#issuecomment-587347070
I have the very start of an ar.c that doesn't do anything yet (attached). That's
used not just by builds but inside of debian's package management and a few
other places.
There's a bunch of stuff in toys/pending/*.c. I got about halfway through
mkdosfs.c before getting pulled away and never getting back to it (attached that
too; turns out you MUST support all the fat12/16/32 variants because it uses the
image size to determine file type. I was vaguely thinking I could make a
genvfatfs.c that worked like an archiver (ala genvfatfs dir | gzip | ssh
remote.sys "cat > img.gz"), and maybe even implement the whole mtools suite).
The mke2fs.c in pending is also half-finished and I haven't touched that in
YEARS (that I was working on for busybox, and copied what I had over into toybox
but it was at the end of the todo heap, and adding ext3 was just a magic file in
a reserved inode number but since then ext4 happened and I haven't had a chance
to look at that at all)...
For diff.c I really wanted to do a "patience diff" algorithm implementation, but
got a conventional one submitted instead and never had a chance to wrap my head
around the pro/con of the version they did. I bookmarked an algorithm comparison
article:
https://blog.jcoglan.com/2017/09/19/the-patience-diff-algorithm/
And have various old bookmarks about patience diff:
https://bramcohen.livejournal.com/37690.html
https://bramcohen.livejournal.com/73318.html
https://en.wikipedia.org/wiki/Patience_sorting
I need to write a less.c (probably using watch.c as a model, and definitely
implementing -R support so colors work). But then I need to do similar code for
the shell's command line editing...
If somebody who actualy _uses_ modules could review modprobe, that would be
nice. My main blocker there is the embedded systems I put together all have
static kernels.
I've always been slightly unclear on what getty.c _does_ and why it's separate
from login.c. (Is it related to stty?)
I want to redo route.c to use the netlink api to add multi-table support (ala
https://android.googlesource.com/platform/external/toybox/+/48e1f81151f6).
> After reading through your state-of-the-toybox message, the commands "tr" and
> "stdbuf" are interesting to me. If you think it is worth a shot for me to give
> it a go, let me know which one you'd recommend.
It'd be great if somebody could tackle stdbuf, I have no idea how that one
works. (The buffering is in libc, how does one program tell the next executable
to use different libc default parameters? Export an environment variable? Is
doing that portable between glibc/musl/bionic? "strings" on the stdbuf binary is
showing _STDBUF_ and LD_PRELOAD and libstdbuf.so and that just sounds ugly...)
My main todo item on tr is I'd like to have utf8/unicode support, but haven't
figured out how to do so yet at a conceptual level because it's matching a
source string with a destination string by position, and things like [:alnum:]
expand to different numbers of entries in ascii vs unicode. We had a thread on
that here:
http://lists.landley.net/pipermail/toybox-landley.net/2020-December/012158.html
Rich Felker said he had a simple way to do it, but we've never sat down to have
him explain it to me.
> Dan
Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ar.c
Type: text/x-csrc
Size: 1990 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20210605/344d3cb8/attachment-0006.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mkdosfs.c
Type: text/x-csrc
Size: 8369 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20210605/344d3cb8/attachment-0007.c>
More information about the Toybox
mailing list