[Toybox] meh

Rob Landley rob at landley.net
Fri Apr 17 05:39:49 PDT 2020


Thunderbird stopped being able to talk to gmail yesterday (the popup
says "Web login required" but logging into the web interface doesn't
help, I'm assuming https://landley.net/notes-2019.html#17-12-2019
finally kicked in and thunderbird is no longer a supported gmail
client. I should migrate the account to dreamhost but I just haven't
got the energy, I'm sending this through the web interface but can't
read 3000 unfiltered messages/day from linux-kernel and qemu-devel
through that.).

For the record, here's where I stopped working on toysh, and what I'd
written of the release notes.
-------------- next part --------------
<a name="??-04-2020" /><a href="#??-04-2020"><hr><h2><b>April ??, 2020</b></h2></a>
<blockquote>
<p>At that moment the ship suddenly stopped rocking and swaying, the engine
pitch settled down to a gentle hum.</p>

<p>"Hey, Ford," said Zaphod, "that sounds good. Have you worked out the controls of this boat?"</p>

<p>"No," said Ford, "I just stopped fiddling with them."</p>

<p>- The Hitchhiker's Guide to the Galaxy</p>
</blockquote>

<p><a href=downloads/toybox-0.8.3.tar.gz>Toybox 0.8.3</a>
(<a href=https://github.com/landley/toybox/releases/tag/0.8.3>git commit</a>)
is out, with two new commands (<b>rtcwake</b> from Elliott Hughes and
<b>blkdiscard</b> from Patrick Oppenlander).</p>

<p>The big news is that the toyroot plumbing now boots to a shell prompt,
with toysh making it all the way through the init script.

 Toysh is still
in pending, but about 80% of the way to being useful. It's still missing some
obvious features (like function support) and a lot of bash features
(like array variables), so isn't out of pending yet.</p>

<p>The mkroot build
musl-cross-make commit 5086175f2902
BINUTILS_VER = 2.32 because the newer one breaks the kernel build
and LINUX_VER 4.19.90 (because the standalone headers package he's
using breaks m68k and s390x). I can't post binaries of the toolchains
because they're GPLv3, but thalheim might.


 The standalone "make sh" build now includes the multiplexer
for builtin commands like "exit" and "cd". Added MAYFORK annotation
for commands that exist in the $PATH but can also be run within the shell
process (and sometimes have different behavior within the shell):
currently applied to help, echo,
false, kill, printf, pwd, test, time, and true.</p>

Elliott added more macos support and tests, and added
fallocate, cp, mktemp, and mv to the macOS defconfig.

New features
Elliott taught <b>patch</b> to understand [FILE [PATCH]] arguments, made
<b>cal</b> highlight the current day, added -T to <b>cp</b>/<b>mv</b>,
did a lot of work on <b>lsattr</b>/<b>chattr</b> (including adding -p
and "chattr ="), and added tar --absolute-names.

Rob added <b>patch -F</b> (fuzz factor) support and <b>help -u</b> (usage only),
taught <b>echo -e</b> about bash extensions like \uXXXX unicode escapes,
<b>setsid</b> now uses -c (like the man page says) instead of -t, and added
-w (wait) and -d (detach from tty). 

Andrew Ilijic added ls -w, removed trailing whitespace on output,
and added tests for -C and -x. Elliott Hughes taught <b>id</b> to
support numeric lookup and handle unknown groups, made -G show all
groups, and removed context= from -Z.

library: remove getdirname() and just use the libc function (which modifies
its argument, but we don't have to free a malloc),
dlist_terminate() can now be called repeatedly on the same list,
new relative_path() function finds path from one directory to another,
and readfd() works like readfile() but on an already open fd.
Use MPATH macros in mkpathat(). Elliott added macOS versions of
dev_minor()/dev_major()/makedev() to portability.c.

Elliott Hughes implemented posix_fallocate() for macOS, removed a
leftover uClibc workaround in fallocate that was breaking macOS,
and moved the table of ELF architectures from file to lib/lib.c (so
readelf can share).

Park Ju Hyung pointed out the fast path of fdlength() was commented out,
and we switched it to the 64 bit API while we were there (and then Elliott
added macOS support).

Joeky taught file to recognize 7z archives.

pending:
Elliott added getopt and readelf.

Jarno Mäkipää taught wget about to follow http 301 and 302 redirects,
and did lots of work on vi. (Elliott also did work on vi.)
Gavin Howard fixed a comparison bug in bc.
Ethan Sommer fixed numerous small issues.

bugfix:
Tar extract now deletes files and symlinks where it's making a directory,
"find -L -type -l" now finds dangling symlinks, extra #ifdefs in
portability.h prevent old gcc versions from barfing on __has_include(),
xgetline() now returns NULL at EOF, tee with no arguments was
writing to stdout twice, setsid works on nommu (I.E. vfork) now.
sntp now uses adjtimex instead of adjtime (to build on bionic).
xcreate_stdio() was checking WARN_ONLY in the wrong field (and tar was
passing it in the wrong field, so it worked there).
Several people wrestled with the xargs "argument too long" problem.
Alessio Balsini fixed memory leaks in loopback_setup() and "wayling"
added a missing continue to losetup.
Elliott fixed xargs -E, various things in modinfo,
added an error check to gzip when using zlib (which copies non-gzip data to
the output verbatim for some reason),
found an case where dirtree could use
uninitialized data and silenced "Invalid argument" warnings (triggered by
Android's selinux policies making stat() and readlink() fail),
fixed locale support in macOS (both in iconv
and in main.c), taught stat to show filesystem time on macOS,
fixed a 32 bit truncation in sntp, and widened the pid fields in ps to
6 digits.

Rich Felker fixed find.c assuming
time_t is a long (y2038 issue on 32 bit).
Greg Kaiser fixed a thinko in get_block_device_size().

Jarno Mäkipää fixed utf8 support in cut -C, and cp --parents.
David Legault complained that dir/.* tells rm to delete dir/.. and we'd do it.
JakeSFR pointed out a bug in file's identification of broken symlinks.


William Haddon fixed cp to treat a directory with a trailing slash
teh same as one without.
Denys Nykula fixed rm -i not to prompt for an empty "" argument.
SebiderSushi reported that chmod g+s wasn't working.

The linux kernel doesn't let an O_PATH fd work with fgetxattr(), so
Elliott switched <b>ls</b> to use the path-based functions now (which is racy,
it means you can stat() one inode and get the xattrs for a different one,
but nobody in kernel land seems to use xattrs much so they're not fully
supported by the API, and who's crazy enough to use xattrs for security
anyway).

Derick Pallas pointed out an xclearenv() bug.

Atatsulo (or possibly luolongjuna) did a lot of work on the <b>ping</b>
command: pointed out min/range/max were out of order,
that we shouldn't print a summary unless we received at least one
reply packet, and implemented ttl support.

Build plumbing
scripts/mkroot.sh is now only about 250 lines long, due to a more concise config format
for the various kernel targets. It also uses /root as the home dir for UID 0,
and creates /dev/fd and /dev/shm in devtmpfs. And it works around a kernel
build bug where "make distclean" doesn't work in a "cp -sfR" symlink
directory. (So if you point LINUX= at unclean source, it was unhappy.
So now it distcleans the source directory before copying it, which modifies
said source directory, which is not ideal, but as usual the kernel guys
<a href=http://lkml.iu.edu/hypermail/linux/kernel/2002.2/00083.html>ignored
the bug report</a>, so... workaround.)</p>

<p>As for mcm-buildall.sh,
of COURSE gcc 8.3 requires a different configuration to build the same
toolchain as a previous version, it's gcc. And it now builds a proper
nommu libc for sh2eb without a broken fork() call in it that can never
be used but prevents compile-time probes from detecting nommu.
And checks that the cross compiler completed before trying to build
the native compiler.

"cross.sh all" announces each target in the title bar, and puts
its logs into root/log, and has better trap handling to stop with one
ctrl-c.</p>

scripts/single.sh now works when PREFIX has no trailing slash.

silentoldconfig no longer feeds "y" to kconfig (which puts menus in a loop),
it just feeds in newlines to accept whatever the default is.

The non-git version number I keep forgetting to update each release moved
from main.c to toys.h.

Fixed a a couple different errors in mkflags.c (one of which caused ls --color
to set all the other flags)

cleanup:
Rob did some cleanup on xargs, ls, md5sum, and sort, tidied up main.c a bit,
made cp, base64, dmesg, and free use FLAG macros,
and switched fallocate to new style global names.
Elliott Hughes switched rfkill from the old byte at a time get_line()
to libc getline(), made du use FLAG() macros, and mad chattr use
standard toybox argument parsing for -v and -p.
Several commands (help, cp) had sub-options removed from menuconfig.

Merged realpath into readlink, and use xabspath() instead of libc realpath().

Documentation:

New roadmap section about <a href=roadmap.html#packages>other packages</a>
that toybox can (eventually) replace.

Update roadmap to note that posix-2008 moved to a different URL (content
at the old URL undergoes random changes), and link to the IETF RFCs.
design.html explains more of the history of environment sizes on links
and has a #bits anchor tag.

Update the <a href=design.html#bits>LP64 section</a> of design.html to
fish the documents out of archive.org now that unix.org is gone,
to show the actual size table locally.

Elliott improved the help of <b>date</b> and <b>chattr</b>, and
made the usage: lines in the posix directory more consistent.


tests
New "txpect" performs interactive tests, running through a sequence of
writes to a command's stdin and reads from stdout and stderr, failing and
reporting the first non-matching step. (This for example lets sh.test check
the shell line continuation logic prompts with $PS1 and $PS2 appropriately
with various unfinished input lines, and that "echo hello; if" doesn't
output hello before prompting for the next line of input.) Added
VERBOSE=xpect to print out each read and write successfully performed by txpect.

runtest.sh only creates an "input" file when the input argument isn't empty,
EVAL doesn't supply -- (you have to provide your own if you want that).

Rob added basic <b>stat</b>, <b>patch</b>, and <b>tee</b> tests.
Jarno added a bunch of <b>vi</b> tests.
Elliott fixed tests for <b>ifconfig</b>, <b>lsattr</b>, <b>chattr</b>,
and <b>date</b>, added tests for find, id, xargs, and made
the id, iconv, env, file, printf and cat tests work on macOS (and skipped
the du tests there). Rob cleaned up chmod tests.

sheer pedantry:
true and false now have usage: lines (which you have to "help false" to see
because they (intentionally!) don't support --help.
false: 5a2329ac47d3
true 2c0288325ac2
renamed get_chunk()/dump_chunk() to read_chunk()/write_chunk() in tail.c
d511650db5b4
Elliott fixed typos.
0fe9185c669b

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.patch
Type: text/x-patch
Size: 14326 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20200417/9317454b/attachment-0001.bin>


More information about the Toybox mailing list