Age | Commit message (Collapse) | Author |
|
|
|
And remove a "nine princes in amber" themed name I missed.
|
|
Instead have one target string and fill it out from start to finish writing
to each location once.
|
|
This is what GNU tar does, so Android's build system jail allows
bzip2, gzip, and xz, but not bzcat, zcat, and xzcat.
Why the function? Because auto-detection works by setting toyflags, so
we need to make sure we test the flags late, so it's either two copies
of this or a function.
|
|
|
|
POSIX finally gave us a way to use echo in a portable way despite
differences of opinion about whether to default interpretation of escape
sequences to on or off: -e enables and -E disables (as already
implemented by busybox and coreutils).
http://austingroupbugs.net/view.php?id=1222
|
|
Commit 9448c33944651c1644ffbd0f52cf9d43cae19599 broke ELF note parsing,
because the bounds checking was off. Fix that but also generalize it so
that we won't need note-specific bounds checking in future.
|
|
There's probably more to do, but it seems usable at this point.
|
|
|
|
leaking memory), and mod env command to test it.
|
|
|
|
|
|
|
|
|
|
and fix tests to pass on host too.
|
|
Gentoo removes verbosely when building packages, for example vim-core:
https://github.com/gentoo/gentoo/blob/665eaa8/app-editors/vim-core/vim-core-8.1.0648.ebuild#L120
Implement like toy cp, without prepending an escape sign to quotation
marks in filenames. Document in a test this difference from coreutils
but similarity to busybox. How do other implementations handle such
escapes? If it matters, would you approach it with a loop and multiple
prints or somehow else?
Short help description follows 141a075, consistent with other commands.
|
|
The return value of -exec was the command's exit code, which did not
account for the fact that an exit code of zero means success, while in
C, zero means failure. From POSIX:
> the primary shall evaluate as true if the utility returns a zero
> value as exit status
This commit flips the return value, and adds two tests.
|
|
|
|
Also be a bit more consistent about `COMMAND [ARG...]` in usage text.
|
|
|
|
Also add a test, and add a test for timeout now it's been fixed.
|
|
Sunday's transition in the US broke a bunch of the tests. Worse, it
broke some of the QA folks' scripts. Finally, the boil that is date's
handling of time zones and daylight time has come to a head...
This patch fixes the newly-failing tests *and* the other tests that were
checked in failing to serve as TODOs.
I've resolved the test TODOs about whether implied year/century in POSIX
format should mean the current year or 1900 in favor of the current
year. Both busybox and coreutils agree, and Rob fixed the code recently
so toybox agrees too, but without fixing the tests.
I've switched tests from Europe/London to Europe/Berlin to avoid
disagreements between C libraries about whether to say "GMT" or "UTC"
when daylight savings is not in force.
The majority of this patch implements what I'd been unsuccessfully
trying to explain on the list: that to correctly implement the distinct
input and output time zones (as demonstrated in the three failing tests
we've been carrying around for a while), we should switch to working
with time_t internally rather than struct tm. I've also added the code
to temporarily switch to the input time zone (and back again).
All the tests now pass.
|
|
|
|
--signal is simply a synonym for the exiting -s.
--foreground disables functionality we didn't yet have: putting the
child into a new process group. I've added the functionality and the
flag to disable it.
--preserve-status also makes it clear that our exit statuses didn't match
the coreutils version. In addition to callers that use --preserve-status
to get away from this madness, I also have callers that check for
specific exit values. This patch implements --preserve-status but also
fixes all the other exit statuses.
(The "125" exit value is broken for toybox in the same way that
`toybox grep --whoops ; echo $?` is. To fix this, we'd need some way to
signal that command-line parsing failures should exit with a different
value than the usual 1 --- 2 for grep, 125 for timeout. I've done as much
as grep manages, and left a TODO.)
Also add timeout tests. I couldn't think of an easy test for
--foreground, so I tested that manually with strace.
Also add some newlines to the `toybox --help` output to make it easier
to find the different sections, and expand the section on durations to
call out that fractions are supported as a matter of policy.
As long as timeout and sleep have text describing the duration syntax,
make them the same. (Personally I'd remove both in favor of the `toybox
--help` output, but as long as they're duplicated, keep them consistent.)
Also remove the SLEEP_FLOAT variant --- xparsetime means that sleep no
longer requires floating point to support sub-second resolution.
|
|
|
|
|
|
Tested manually on an Android device with:
adb shell find /system -context u:object_r:wait_for_keymaster_exec:s0
adb shell find /system/bin -context '"*key*"'
adb shell find /system/bin -context '"*tool*"'
|
|
It's in the Linux 5 kernel headers. If, like me, you'd never heard of
it:
https://www.phoronix.com/scan.php?page=news_item&px=C-SKY-Approved-Last-Arch
|
|
|
|
(resulting in 400% CPU with 4 threads), and add a couple comments.
|
|
More consistent tense, capitalization, and punctuation. A few commands were
missing an introductory line, so I copied those from the first comment
line.
|
|
|
|
We hadn't updated the output in -b mode ever since I broke this in 2016.
Bug: http://b/126347053 "top doesn't seem to update the output when run in batch mode (-b)"
|
|
|
|
Inspired by some of the small patches that have gone by recently.
Limited to only things found in `generated/help.h`, plus a wider cleanup
for the more common "milisecond" typo.
|
|
--quiet is used 3x more than --silent in my corpus, but they're both
used surprisingly often. (Surprising to someone who thinks -q is part of
the core set of grep options that "everybody knows".)
|
|
Linux has more states than we were giving it credit for, which led to
our numbers not adding up. Since the exact details seem to change
between versions, and since having code specific to each kernel version
is unattractive, go with the heuristic that there are relatively fewer
"stopped" states (and they change less frequently), so all unknowns are
"sleeping".
|
|
|
|
|
|
This also makes everything more readable by separating out the -b no
formatting case.
The whitespace trimming for -b isn't strictly necessary, but it looks
weird if we output unnecessary spaces at the end of the line in -b mode,
and we've fixed it before, so let's not regress here. It also seems more
logical to do this in the one place where it actually happens.
|
|
|
|
|
|
Both refresh the display in the traditional implementation.
|
|
Even phones have enough RAM these days that KiB is not a reasonable
unit. Traditional top always uses MiB instead of always using KiB, but
we may as well just let human_readable pick a unit (that way if KiB is
reasonable on your box, that's what you'll get).
Before:
Tasks: 967 total, 1 running, 581 sleeping, 0 stopped, 0 zombie
Mem: 196734820k total,183891564k used, 12843256k free, 5805008k buffers
Swap:199888892k total, 719104k used,199169788k free,130367280k cached
After:
Tasks: 965 total, 2 running, 577 sleeping, 0 stopped, 0 zombie
Mem: 188G total, 175G used, 13G free, 5.5G buffers
Swap: 191G total, 702M used, 190G free, 124G cached
|
|
Matches traditional top.
|
|
Plus new tests.
|
|
Very few places actually check for errors from emit, and I actually see
the same endless loop from "sed (GNU sed) 4.4" on current Debian, so I'm
not sure this isn't Broken As Designed, but an endless loop spewing
"short write" (or saying nothing, in the case of GNU sed) really doesn't
feel like useful behavior in face of EPIPE, which really isn't going to
fix itself. Certainly not being able to run the sed tests to completion
is pretty annoying --- which is why, unless we remove this test as
invalid, we should probably also add a SKIP_HOST=1 to the "b loop" test.
Note that even with this fix you'll see the error twice:
sed: short write: Broken pipe
sed: short write: Broken pipe
Once from the first = command to fail, and then another from the !FLAG(n)
flush of the pattern space.
|
|
The test for \N where N was larger than the number of capturing groups
in the regular expression was incorrect, and firing for cases such as
matching __(ARM_)?NR_([a-z]*) against __NR_read, where the first group is
empty (because it failed to match) but the second group did match "read".
Use regex_t's re_nsub for the error check, and treat rm_so == -1 as a
signal to just copy nothing into the result.
(Found trying to build minijail in AOSP.)
|
|
Add support for more input formats, primarily the ISO formats used by
the AOSP build.
I've improved/added to the tests a bit to cover these changes, and to
explain the reasons for the various remaining test failures (none of
which are regressions caused by this patch).
|
|
|