aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
AgeCommit message (Collapse)Author
2020-12-05Fix find empty argument handling and add test.Rob Landley
2020-11-25Luke Frankart pointed out a typo (0x111 should be 0111). Fix and updateRob Landley
tests to catch this. While there add -k to test sticky bit.
2020-11-25Fix help text to explain why o+s isn't +t, add test +s not setting +t.Rob Landley
2020-11-22Minor cleanup.Rob Landley
2020-11-17Tweak date.c.Rob Landley
2020-11-15date: add --iso and the %:z output format.Elliott Hughes
I didn't know until implementing this that --iso is actually called --iso-8601 and that GNU date will actually accept any prefix. --iso-8 works fine too. I've assumed that --iso (that I always used) and --iso-8601 (as given in the documentation) are the only two that matter.
2020-11-14Allow 0 prefix to optstr to include argv[0] in optargs[0].Rob Landley
2020-11-12file: harden against invalid input.Elliott Hughes
I promised months ago I'd fix this, and there was a (not visible to the public but filed by a member of the public) bug filed against Android in the meantime, but judged No Security Impact because "toybox is not a security boundary". Anyway, it seemed high time I learned about fuzzing command-line tools with AFL++, so here we are. With these patches (and starting from the ELF files in test/files/elf), toybox file survived ~24hours against AFL++. Amusingly it corrupted the ELF files hard enough that it also managed to find a bug in the code for MS-DOS executables, which is the motivation for the final hunk in this patch. Bug: http://b/159065007 Test: ~/AFLplusplus/afl-fuzz -i tests/files/elf -o fuzz-out -- ./file @@
2020-11-11date: add --utc (synonymous with -u)Elliott Hughes
2020-11-11file: identify Android Binary XML.Elliott Hughes
Android is introducing a new binary XML format that is a drop-in replacement for many existing .xml files written by system_server. Since engineers may be surprised when encountering this new format, add it to the "file" tool to aid identification in the field.
2020-10-29Make it easier to switch regex implementations.Elliott Hughes
One reason to use toybox on the host is to get the same behavior across Android/Linux/macOS. Unfortunately (as we've seen from a few bugs) one area where that doesn't quite work is that toybox uses the libc regular expression implementation. That's fine, and mostly what users want, but those folks trying to get the exact same behavior everywhere might want to switch in a known regex implementation (bionic's NetBSD regex implementation, say) for increased consistency. That actually works pretty well, but portability.h has an #ifndef test for REG_STARTEND before including <regex.h> that gets in the way. To make up for that, this patch removes the unnecessary #include <regex.h> from grep.c itself.
2020-10-20Typo.Rob Landley
2020-09-12Replace HR_COMMAS with HR_NODOTRob Landley
The comma thing turned into an internationalization can of worms, don't go there. Keep the "show megabytes on systems with >10G" logic which includes not showing 0.0 for single digit values.
2020-09-09Cleanup of logger.c. (Asked for more testing on the list.)Rob Landley
2020-09-09Attempt internationalization of HR_COMMAS, 9 digit memory sizes for top,Rob Landley
and use the comma format when selected even if <3 digits (no 0.0M)
2020-09-08logger.c was failing to properly log local0-local6 facilities, due to a ↵Chris Sarra
string parsing error. This patch enables proper local facility handling.
2020-09-04Autodetect pid length.Rob Landley
2020-09-04Add commas to top display, and adjust memory units to megabytes if >10G RAM.Rob Landley
2020-08-24tar: add -I (--use-compress-program) support.Elliott Hughes
This also changes the other compression options (such as -j) so that we pass no arguments for compression and just -d for decompression, which is what -I does to its filter and which appears sufficient. (I think I used -dc before just out of habit, since that's what I've been typing on the command line for decades.)
2020-08-23mv should only prompt for file being unwriteable when stdin is a tty.Rob Landley
2020-08-23Peter McConalogue pointed out that cp/mv -i prompt should default N.Rob Landley
Also, the failing mv test was because posix says to prompt when mv-ing over an unwriteable file only when stdin is a tty (but -i prompts either way)
2020-08-21Fix cp -P to not follow symlinks.Martin Stjernholm
Also fix help text to say that it is not the default.
2020-08-21Honor --no-preserve-owner for archive creation, and tidy up header comments.Rob Landley
2020-08-21cpio: fixes for Android kernel build.Elliott Hughes
Allow -pd to work by changing -p from an option that takes an argument to an option that implies there will be an argument (that is, `-pd x` is `-p -d x` with x being the directory for -p, rather than `-p d x` with d being the directory, as we previously interpreted it). Fix -d (aka --make-directories) to not be a no-op. Previously we acted as if this was always on. Accept --quiet and effectively just ignore it, since toybox cpio doesn't seem to produce any output that --quiet would suppress.
2020-08-19Cleanup symlink handling.Rob Landley
2020-08-19Patch out memory leak in tar.cChris Sarra
2020-08-18Add missing longopts alias for chgrp/chown and rmdirAntoni Villalonga
Heavily used long params under some contexts for already implemented options: chgrp/chown: Add alias '--no-dereference' for '-h' rmdir: Add alias '--parents' for '-p'
2020-08-04xparsedate: support UTC offsets.Elliott Hughes
Requested in https://github.com/landley/toybox/issues/130, quoting an old version of the toybox help. This is also supported by coreutils. Set $LANG to C in the date tests so that they pass with TEST_HOST=1 (they were already failing for me, presumably related to a newer glibc).
2020-08-04xargs: fix help formatting.Elliott Hughes
2020-08-03Mark Salyzyn implemented support for xargs -P (run parallel jobs) because heRob Landley
has a build script that goes much faster with it, and added tests for it. I reimplemented it a different way, and did SIGUSR1 and SIGUSR2 support.
2020-07-30Don't need "match", just test *t.Rob Landley
2020-07-30find: support -type a,b,c.Elliott Hughes
Fixes #227.
2020-07-20patch fuzz: Always output original file's ' ' context lines, not from hunk.Rob Landley
2020-06-23William Djupström reported tar --exclude wasn't working. Fix and add test.Rob Landley
(Also fix -v output going to stderr when it shouldn't.)
2020-06-16file: add GIF version information.Elliott Hughes
This let me compare against the host for #225.
2020-06-16Ryan Prichard reported that file wasn't getting gif heights right.Rob Landley
2020-06-09chmod: fix -R and dangling symlinks.Elliott Hughes
Found trying to run the libc++ tests. For coreutils, `info chmod` says: 'chmod' ignores symbolic links encountered during recursive directory traversals. Bug: http://b/155809792
2020-06-09tar: fix bugs with adding hardlinks to archiveWilliam Djupström via Toybox
2020-06-08tar: fix extracting long file pathsWilliam Djupström
2020-05-31sed: add -s to the synopsis too.Elliott Hughes
2020-05-30Ethan Sommer pointed out an unnecessary return.Rob Landley
2020-05-29Add sed -sRob Landley
2020-05-28remove unneeded ; after GLOBALSEthan Sommer
2020-05-09Shrink sed --help from 150 lines to 91.Rob Landley
2020-05-01Minor cleanup.Rob Landley
2020-04-28Remove unnecessary MAYFORK.Rob Landley
2020-04-20patch: fix out of bounds memory access.Elliott Hughes
On empty lines, we'd read one byte before the start of the buffer.
2020-04-16cpio: fix tests by removing --trailer.Elliott Hughes
f2866cf58a07c9d681ecd6695ea969ac70e59a3d fixed the cpio --trailer check as it claimed to, but doing so changed our behavior (since it used to be always-on and is now off unless you supply --trailer). This broke one of the cpio tests. Since I can't find any other cpio that has a --trailer option (or its inverse), this patch removes --trailer. This reverts our behavior to our old behavior (always include the trailer). Judging by the fact that the cpio tests pass with TEST_HOST=1, this seems to be the expected behavior.
2020-04-15cpio: fix --trailer flag check, switch to FLAG() macros.Ethan Sommer
2020-04-13Humor asan.Rob Landley
(ls would read from an uninitalized variable and never use the result because the test is afterwards, but asan freaks about impurity and unclean quantum state that's never observed or some such. You read uninitialized but definitely allocated stack memory into a REGISTER, and then performed an ADDITION on it to produce a result you never use! For SHAME!)