aboutsummaryrefslogtreecommitdiff
path: root/toys
AgeCommit message (Collapse)Author
2019-03-17More tar cleanup.Rob Landley
2019-03-17More tar cleanup.Rob Landley
2019-03-16bc: fix an overflow bug in bc_num_ulong()Gavin Howard
2019-03-16Next round of tar cleanup.Rob Landley
2019-03-14grep: use TOYFLAG_ARGFAIL for grep too.Elliott Hughes
Also add a test, and add a test for timeout now it's been fixed.
2019-03-14load_policy: mention SELinux in the help.Elliott Hughes
2019-03-13timeout: remove bogus depends-on.Elliott Hughes
2019-03-13date: fix various time zone/daylight time issues.Elliott Hughes
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.
2019-03-13More tar cleanup.Rob Landley
2019-03-13Use defined constants for mkpathat.Hadrian Węgrzynowski
2019-03-11More tar cleanup.Rob Landley
2019-03-10Add TOYFLAG_ARGFAIL() to allow argument parsing failures to exit with value.Rob Landley
2019-03-10timeout: --foreground, --preserve-status, and --signal.Elliott Hughes
--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.
2019-03-10find: minor whitespace cleanup.Elliott Hughes
2019-03-10find: improve -context behavior on failure.Elliott Hughes
2019-03-10Make multiple sendfile variants, and teach xpopen_both() to use existingRob Landley
stdin/stdout filehandles.
2019-03-09find: add -context.Elliott Hughes
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*"'
2019-03-09file: add c-sky ELF machine.Elliott Hughes
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
2019-03-09Half-finished su change checked in, sorry.Rob Landley
2019-03-07Add reset_env() and make su and login use it. Do long-delayed login cleanup.Rob Landley
2019-03-06More tar cleanup.Rob Landley
Dear gcc: if (i || node=blah) x = i ? blah : node; Don't complain "node may be used uninitialied", it can't be. That warning is a gcc bug. (I should add a node = node to the initialiation to shut up the warning, but gcc has failed to emit "may be used uninitialized" reliably for 15 years and it still does.)
2019-03-04More tar cleanup.Rob Landley
2019-03-04Don't print (null) in error messages.Rob Landley
2019-03-04Consistently use ARRAY_LEN.Elliott Hughes
2019-03-03Cleanup pass on tar.Rob Landley
2019-03-02Make top -H show TID instead of PID, not collate %CPU into parent threadRob Landley
(resulting in 400% CPU with 4 threads), and add a couple comments.
2019-03-02Promote devmem.Rob Landley
2019-03-02Improve help consistency.Elliott Hughes
More consistent tense, capitalization, and punctuation. A few commands were missing an introductory line, so I copied those from the first comment line.
2019-03-02Fix instances of "Usage:" rather than "usage:".Elliott Hughes
2019-03-02devmem: new command.Elliott Hughes
Intended to replace Android's toolbox `r`, but behaving more like a drop-in replacement for busybox's `devmem`.
2019-03-01William Djupström pointed out we need to chown() the tty.Rob Landley
Do the FLAG() and short argument variable cleanups while we're there.
2019-03-01Yes it's a one instruction race, but it bothers me.Rob Landley
2019-03-01Minor tweaks.Rob Landley
2019-02-27top: fix -b.Elliott Hughes
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)"
2019-02-25arp: inline get_hw_add and minor sscanf error handling cleanupColin Davidson
2019-02-24grep: add missing long synonyms used in AOSP.Elliott Hughes
2019-02-23One last (for now) typo.Elliott Hughes
This one actually introduced by my last cleanup. (But helpfully pointed out by the machines when I tried to upload my last cleanup to the AOSP gerrit...)
2019-02-23Add UUID= support to mount, via blkid -U.Rob Landley
2019-02-23Add blkid -U and -L.Rob Landley
2019-02-23Promote mcookieRob Landley
2019-02-23Cleanup mcookie.Rob Landley
2019-02-23Here's an 'mcookie' implementation for toybox.Isaac Dunham
mcookie simply prints out 16 bytes of entropy in hexadecimal; it is typically used as the source for the "MIT magic cookies" that X11 uses for "secure" connections. The only implementation I know of is in util-linux; the problems with its documented behavior motivated me to write an alternate implementation. Specifically, getting 128 bytes from the kernel and finding the MD5 sum is not a sane PRNG, especially when only 16 bytes are needed.
2019-02-23Bumper typo cleanup.Elliott Hughes
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.
2019-02-23Switch losetup to short arg var style and force typecasts for printf.Rob Landley
2019-02-23Switch mount to use FLAG() macros.Rob Landley
2019-02-21Fix typo in helpKevin van der Kamp
2019-02-21getfattr: add --only-values.Elliott Hughes
Needed to improve cp(1) testing.
2019-02-20Exit code should indicate _which_ signal oneit's exiting due to.Rob Landley
2019-02-20Simplify netcat a lot using the net.c upgrades from last commit.Rob Landley
2019-02-20Minor cleanups, mostly wordwrapping.Rob Landley