Age | Commit message (Collapse) | Author |
|
Based loosely on the Plan9/Inferno utility, and a convenient way to go back
and forth between code points and utf8 sequences.
This patch also fixes a couple of bugs in wctoutf8 (and the tests for this
toy effectively serve as unit tests for wctoutf8/utf8towc).
|
|
Add new toy `pwgen`.
A usefule password generation utility.
|
|
The AOSP build doesn't use tr (or anything that's still in pending), but
the kernel folks have been more aggressive. They found that tr's
pathological flushing was adding minutes to their build times.
Just removing the fflush() made tr significantly faster for my trivial
test, but still slow, with all the time going into stdio. Rewriting the
loop to modify toybuf in place and then do one write per read made most
of the difference, but special-casing the "neither -d nor -s" case made
a measurable difference too on a Xeon.
Bug: http://b/174773617
|
|
|
|
Use 0 optstr prefix, fix bug initializing toys.envc one too low.
|
|
I also promised to fix readelf. Where in file(1) I made no attempt to
say what was bad (or even to change `goto bad` to explicitly say that
*anything* was bad), I believe that readelf is much more likely to be
shown invalid ELF files, and that it would be useful to have some clue
as to what's wrong. Relatedly, this patch removes all existing
error_exit() calls in case it's being used on multiple files.
Again, this survived ~24hrs of AFL++ trying to blow its house down.
Test: ~/AFLplusplus/afl-fuzz -i tests/files/elf -o fuzz-out -- ./readelf -a @@
|
|
|
|
|
|
|
|
(The bug is that "echo hello \" followed by just enter should end the $PS2
state but it persists when the line is empty because resulting collated line
still ends with \ so it wants another line.)
|
|
|
|
Fixes https://github.com/landley/toybox/issues/251 where `stty 300` was
mangling c_iflags to 0x300 because even if we don't match a full hex
specification of struct termios, sscanf() will have overwritten the
first value, which is c_iflag.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Debug wildcard * match, teach skipslash() to fill out a wildcard deck,
make collect_wildcards() flush remove the parsing-only 0th entry.
|
|
|
|
|
|
|
|
|
|
ftruncate was failing on device files, leading to whole dd.c failures.
This patch allows us to dump device files.
|
|
|
|
contexts like scripts, and tweak debug scaffolding.
|
|
|
|
Bash produces different output for that test, but I'm not sure I care?
http://lists.landley.net/pipermail/toybox-landley.net/2020-September/011990.html
The problem is parse_word() guarantees its output's quotes/escapes
are completed, but brace expansion happens after parse_word() and thus
violating assumptions later code depends on to not do redundant error
checking. The easy fix is to escape punctuation produced by parse_word
(which in bash can only happen when you span upper and lower case ranges
so "\" is the only interesting character). I could special case this to
match bash exactly, but I'm waiting for someone to complain instead.
|
|
|
|
|
|
|
|
|
|
|
|
This patch introduces a simple watchdog implementation for toybox. We
send the appropriate ioctls to set the relevant timeouts, and intercept
signals to safely shut down if required.
|
|
|
|
The key issues here turned out to be that getty is responsible for
creating the file if it doesn't exist, and that the -H flag doesn't
control whether utmp is updated, but whether or not to override the
hostname within the utmp entry.
While I'm here switch to the more modern utx APIs that all the non-pending
parts of toybox use, and remove the duplication.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The sprintf() call, while technically valid (17 bytes fits in an 18
byte allocation) trips Alpine fortify-headers due to checking for
allocations that could potentially overrun.
The call is pointless anyway -- as we are appending a constant to
another constant, it is better to just let the compiler do so and
calculate the size. This is supported by ISO C89 and later, and
thus any compiler that would be used to compile toybox.
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
|
|
|
|
The glibc headers also provide that member, but s6_addr is the portable way.
This fixes compilation on musl libc.
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
|
|
|
|
pointing to end of current block so we don't have to search for it later.
|