aboutsummaryrefslogtreecommitdiff
path: root/toys
AgeCommit message (Collapse)Author
2020-11-17Fix printenv -0 (broken by the lib/args.c 0 prefix change).Rob Landley
2020-11-17Tweak date.c.Rob Landley
2020-11-16Factor out do_source(), fpathopen(), and prompt_getline().Rob Landley
Use 0 optstr prefix, fix bug initializing toys.envc one too low.
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-12readelf: harden against invalid input.Elliott Hughes
I also promised to fix readelf. Where in file(1) I made no attempt to say what was bad (or even to change `goto bad` to explicitly say that *anything* was bad), I believe that readelf is much more likely to be shown invalid ELF files, and that it would be useful to have some clue as to what's wrong. Relatedly, this patch removes all existing error_exit() calls in case it's being used on multiple files. Again, this survived ~24hrs of AFL++ trying to blow its house down. Test: ~/AFLplusplus/afl-fuzz -i tests/files/elf -o fuzz-out -- ./readelf -a @@
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-11-08Teach devmem about nommu and 0x prefix on address. Print hex or decimalRob Landley
output depending on whether address was hex or decimal.
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-28Tweak help text again.Rob Landley
2020-10-23Fix endless recursion bug on nommu for sh -c 'echo $(echo)'Rob Landley
2020-10-22Add nommu-able xvdaemon() and use it to remove some TOYBOX_FORK dependenciesRob Landley
2020-10-21blkdiscard: fix uninitialised offsetPatrick Oppenlander
2020-10-21Tweak watchdog help.Rob Landley
2020-10-21Promote watchdog.Rob Landley
2020-10-20Typo.Rob Landley
2020-10-20Can't call daemon() on nommu.Rob Landley
2020-10-19More tests, and a workaround to pass one of them.Rob Landley
(The bug is that "echo hello \" followed by just enter should end the $PS2 state but it persists when the line is empty because resulting collated line still ends with \ so it wants another line.)
2020-10-19Implement source, fix empty ${x-alt}, use %zu as suggested by e5ten.Rob Landley
2020-10-18Add sha3sum.Rob Landley
2020-10-15rtcwake: default to UTC if /etc/adjtime can't be readPatrick Oppenlander
This is consistent with the util-linux implementation.
2020-10-15hwclock: default to UTC if /etc/adjtime can't be readPatrick Oppenlander
This is consistent with the util-linux implementation.
2020-10-15stty: don't mangle c_iflags.Elliott Hughes
Fixes https://github.com/landley/toybox/issues/251 where `stty 300` was mangling c_iflags to 0x300 because even if we don't match a full hex specification of struct termios, sscanf() will have overwritten the first value, which is c_iflag.
2020-10-15Patrick Oppenlander suggested watchdog also catch SIGINT.Rob Landley
2020-10-14Fix && || traversing loops, and typecast past size_t being stupidly typed.Rob Landley
2020-10-14Implement ${var/search/replace}Rob Landley
2020-10-13Fix up ${x%y} ${x^y} ${x,y} and add tests.Rob Landley
2020-10-11toysh: more variable/wildcard plumbing and tests.Rob Landley
2020-10-06toysh: Yank debug scaffolding.Rob Landley
2020-10-06toysh file wildcards: echo toys/*/*.c works now.Rob Landley
2020-10-05Update i2ctools.cchrisrfq
Fix i2cdetect parameter reading so "last" value is read from correct argument.
2020-10-04Implement ${x#y} and ${x##y}Rob Landley
Debug wildcard * match, teach skipslash() to fill out a wildcard deck, make collect_wildcards() flush remove the parsing-only 0th entry.
2020-10-02Cleanup pass on route.cRob Landley
2020-10-01Debug wildcard plumbing.Rob Landley
2020-09-27Implement wildcard match plumbing. (Not yet fully debugged.)Rob Landley
2020-09-23Only attempt to truncate regular files in dd.Rob Landley
2020-09-23Add ftruncate logic to handle non-regular filesChris Sarra
ftruncate was failing on device files, leading to whole dd.c failures. This patch allows us to dump device files.
2020-09-23Cleanup pass on stty.cRob Landley
2020-09-14Fix multiline case/esac parsing, make syntax_err() exit non-interactveRob Landley
contexts like scripts, and tweak debug scaffolding.
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-10Add ipv6 support to wget.cChris Sarra
2020-09-10blkid: don't show empty tags.Elliott Hughes
The util-linux blkid (even if explicitly asked with -s) won't show you a tag with no value.
2020-09-09Use flag macros and document -rn options.Rob Landley
2020-09-09Use the infrastructure properly.Rob Landley
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-05Fix segfault for sh -c 'echo {a..Z}'Rob Landley
Bash produces different output for that test, but I'm not sure I care? http://lists.landley.net/pipermail/toybox-landley.net/2020-September/011990.html The problem is parse_word() guarantees its output's quotes/escapes are completed, but brace expansion happens after parse_word() and thus violating assumptions later code depends on to not do redundant error checking. The easy fix is to escape punctuation produced by parse_word (which in bash can only happen when you span upper and lower case ranges so "\" is the only interesting character). I could special case this to match bash exactly, but I'm waiting for someone to complain instead.