Age | Commit message (Collapse) | Author |
|
|
|
Posix says you removing a non-empty directory "shall fail" in both:
https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/functions/unlinkat.html
https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/functions/rmdir.html
So toybox mv went ahead and unlinked the directory even if the contents
hadn't all been deleted because posix guarantees it to be harmless. But
cgroups (https://lwn.net/Articles/679786/) deletes the non-empty directory,
thus the Linux Test Project's cgroups_fj_function test6 was failing with
toybox mv because they depend on not triggering the posix violating behavior.
Work around it by having mv DIRTREE_SAVE failing nodes and then check for
a non-empty ->child in the COMEAGAIN as a signal not to unlink the dir.
While I'm there do some code cleanup, add a cp -i test...
|
|
|
|
fstat() doesn't fail on stdin, so check for fd 0 explicitly so we don't
try to access zero length array when optc was zero. (Plus can't reopen '-'.)
|
|
new lib/ flag), allow -s to be fraction of a second, inline (anonymous)
struct so globals.h isn't using an incomplete type, blank line in
GLOBALS() between option args and other variables, collate
tail_continue() to one function, add test.
|
|
(Based on someone else's patch.)
Implementing -F with inotify is a lot more work (including more
portability shims for macOS), so this is a simpler polling
implementation.
Also fix my earlier mistake where xnotify_add() wasn't actually an 'x'
function that exits on failure.
|
|
|
|
|
|
and not many systems need to know "free terabytes".
|
|
|
|
|
|
|
|
I don't think it was wrong before, but the strchr() in particular left
me scratching my head. This formulation is slightly cheaper and seems
more obviously correct.
(Unrelated but nearby, I don't understand why anyone would ever want to
calculate these tables at runtime, so this seems like another
unnecessary CFG_TOYBOX_FLOAT to me, though an unusual one where we might
want to _remove_ the floating-point code.)
|
|
|
|
|
|
The intent here seems to have been to ignore lines with too few
arguments to be valid, but since strtok() returns NULL at the end of the
string, if you only have "verb noun", you'd be falsely rejected.
Since we've kept a count anyway, just check the count.
|
|
Make everything an OLDTOY of md5sum (combining help text), remove enum,
combine unions, actually track 128 bit count for sha384/512.
|
|
|
|
|
|
Used by someone's script.
|
|
|
|
|
|
work for SHA-512's 64-bit values
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
I don't _think_ that can happen with the .dep files since they're
machine-generated, but the config files can and do contain empty lines
to aid readability.
(Not found on Android, so I haven't tested this, but the code already
even contained a special case for empty lines. I haven't touched the
/proc/modules loop because the kernel definitely isn't going to insert
empty lines, and that code _would_ need to be modified to cope with
empty lines, and since I can't test this, that would be not just
pointless but also irresponsible!)
|
|
|
|
The maximum unicode code point is 0x10ffff which is 21 bits.
|
|
|
|
|
|
(utf8 can go to 7 bytes but unicode can't) so only test unicode range.
|
|
|
|
|
|
|
|
|
|
I don't see the need for the separate buffer, and just using dprintf()
directly is less code. The only downside really is having to get the
right number of `%c`s in your format string.
|
|
|
|
|
|
|
|
|
|
This patch does two things:
1. Enable line buffering for echo and yes. I found this through test
flakiness from the toybox xargs tests running in CI on devices where
"echo" is provided by toybox. For `echo y`, GNU echo does one write
of "y\n" but toybox echo was doing two writes, which makes it more
likely (4% on the heavily-loaded CI machines) for writes from the two
processes to be interleaved.
2. Fix line buffering on glibc if you're calling `toybox foo` rather
than `foo`. Otherwise we come through once and switch to unbuffered
mode, then again and switch to line buffered mode --- which doesn't
seem to actually work in glibc unless you specify a buffer (so
passing toybuf and sizeof(toybuf) works, but NULL and 0 doesn't).
I hit the second issue trying to reproduce the first issue on the desktop
rather than on Android.
(If you're scratching your head wondering "why yes(1) too, not just
echo(1)?", that represents a blind alley I went down when I mistook
which tool was in use. It seemed like the same principle should apply,
and it matches what other implementations do.)
|