aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-03-25find: fix inverted -exec exit statusVidar Holen
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.
2019-03-24Factor out xparsedate() and xvali_date() into lib.Rob Landley
2019-03-24vi: Code style cleanupJarno Mäkipää
Variable initialization to start of blocks Space after if,for,while: if() -> if () Space after comma on function calls: write(fd,buf,count); -> write(fd, buf, count); Spaces surrounding variable initialization Pointer * binding to variable instead of type: int* i -> int *i Spaces surrounding compare operators No spaces surrounding arimetic operators Some aligntment whitespace fixes Still messy and needs more cleanup, but there is bigger issues to solve first.
2019-03-23vi: Removed C99/GNU99 style for loop initializersJarno Mäkipää
Removed for(int i = 0;....) style loop initializers to be consistant with project style. Removed few unused global variables Added 2 empty white space lines back to CONFIG comment section.
2019-03-23vi.c double_list based implementation.Jarno Mäkipää
Has beginnings of reading file, saving file, hjkl movement, insert, ex (only w, wq, q!), search with /, some other normal mode actions (dd, w, b, e), some utf8 support Everything is still very unfinished and partly behaves wrongly comparing to original vi. But simple tasks like modifying short config files should be possible. Some things like draw_page needs serious refactor since it now writes whole screen after every keypress. Didint bother to refactor yet if linked list needs to be replaced with something else...
2019-03-23login: clear environment when -p is absentWilliam Djupström
2019-03-22Silence stupid, pointless warnings.Rob Landley
Two "is never used uninitialized" and one "we don't trust you to get clearly documented operator precedence right". (The compiler may not "suggest". Every time I go "abc && def || exit 1" in the shell it means I know the operator precedence _and_ the short-circuit rules, which are the same as C here. This is a warning aimed at C++ developers, it should not be enabled for C.)
2019-03-22My todo entries were bothering people.Rob Landley
2019-03-22More tar cleanup, add --owner and --group, and start of new tests.Rob Landley
2019-03-21Test for compiler existence when sourcing portability.sh.Rob Landley
2019-03-20Next round of tar cleanup.Rob Landley
2019-03-18cmp/env/nice/nohup/sort: use TOYFLAG_ARGFAIL.Elliott Hughes
Also be a bit more consistent about `COMMAND [ARG...]` in usage text.
2019-03-18Document the -k2.3,4.5 syntax and make it behave closer to the other one.Rob Landley
2019-03-18diff: use TOYFLAG_ARGFAIL.Elliott Hughes
This one with a little cleanup of unnecessary duplication.
2019-03-17More tar cleanup.Rob Landley
2019-03-17Fix xstrndup() bug.Rob Landley
Now there's a second user... the libc function already null terminates at len+1, and it doesn't malloc the full size if strlen() smaller so the redundant termination stomped unallocated memory. Oops. sort.c never noticed because it calculated length to truncate or copy existing string, so never hit this.
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-14I had some pending grep tests I hadn't checked in too.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-14date: don't hard-code 2019 in the test.Elliott Hughes
I'm not worried about hard-coding the *century* in the other test. We'll be long dead before that's an issue, and it's easier to read this way.
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-11Add a code style note.Rob Landley
2019-03-11Work around musl-libc limitation.Rob Landley
2019-03-11I've hit a test failure twice where find -newer didn't because the timestampsRob Landley
were identical, so add a small delay.
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-10Add missing isatty(3) call.Elliott Hughes
2019-03-10Do a rm -rf of testdir between each command so debris files don't accumulate.Rob Landley
2019-03-10Make xsendfile() variants handle -1 length properly again.Rob Landley
2019-03-10install.c doesn't include the standard headers so hasn't got ARRAY_LEN()Rob Landley
2019-03-10Don't redirect stderr or xexec() error hidden.Rob Landley
2019-03-10Make multiple sendfile variants, and teach xpopen_both() to use existingRob Landley
stdin/stdout filehandles.
2019-03-09Cosmetic tweak.Rob Landley
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