aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-12-11Sigh, remove debug code checked in by mistake.Rob Landley
2020-12-11The "fall back to C.UTF-8" check was backwards, and make TOYFLAG_LINEBUFRob Landley
configurable.
2020-12-08Remove last traces of CONFIG_TOYBOX_I18N.Elliott Hughes
`make macos_defconfig` was grumbling.
2020-12-08Better conversion of toycans-big.jpg to png. (Just rotate 90 degrees.)Rob Landley
2020-12-07Rename randbuf and hook up -sRob Landley
2020-12-07Promote pwgen.Rob Landley
2020-12-07Cleanup pwgen as described on the list.Rob Landley
http://lists.landley.net/pipermail/toybox-landley.net/2020-December/012169.html
2020-12-07scripts/runtest.sh: fix `toyonly` in a way that also works for mksh.Elliott Hughes
mksh doesn't support the =~ extension, so my previous change -- while fixing the host -- broke Android.
2020-12-07sed: add 'x' flag to the 's' command.Elliott Hughes
The GNU tar manual, when talking about the `tar --transform` option that I need to implement, describes the 'x' flag by saying "regexp is an extended regular expression (see section 'Extended regular expressions' in GNU sed)". Only it turns out that even the latest GNU sed doesn't actually have that flag. It's unique to `tar --transform`. That link is just telling you that the sed manual will explain extended regular expressions, not that GNU sed also supports the 'x' flag. So I don't know whether we want this in toybox sed after all. (It made sense that sed would have such a flag, but no sed that I know of actually does.)
2020-12-06unicode: new toy.Elliott Hughes
Based loosely on the Plan9/Inferno utility, and a convenient way to go back and forth between code points and utf8 sequences. This patch also fixes a couple of bugs in wctoutf8 (and the tests for this toy effectively serve as unit tests for wctoutf8/utf8towc).
2020-12-06id.test: hacks to pass on Raspberry Pi OS.Elliott Hughes
The rest of `make tests` all pass on a Raspberry Pi 400.
2020-12-06Remove CONFIG_TOYBOX_I18N and just always support utf8.Rob Landley
2020-12-05Fix find empty argument handling and add test.Rob Landley
2020-12-05new toy: Add pwgenMoritz Röhrich
Add new toy `pwgen`. A usefule password generation utility.
2020-12-05tr: fix pathological flushing.Elliott Hughes
The AOSP build doesn't use tr (or anything that's still in pending), but the kernel folks have been more aggressive. They found that tr's pathological flushing was adding minutes to their build times. Just removing the fflush() made tr significantly faster for my trivial test, but still slow, with all the time going into stdio. Rewriting the loop to modify toybuf in place and then do one write per read made most of the difference, but special-casing the "neither -d nor -s" case made a measurable difference too on a Xeon. Bug: http://b/174773617
2020-12-05scripts/runtest.sh: fix `toyonly` for sed.Elliott Hughes
sed lies to fool autoconf, but also confuses the toybox test suite. Without this patch we're skipping all "toyonly" tests on both GNU and toybox sed.
2020-12-05Small cleanup.Rob Landley
2020-12-04chmod: support complex modes.Elliott Hughes
Change 5109da9b3e6a898c8e0ad647303a1b375e3d97d3 caused test.test to call chmod with mode `u+s+s` which passes on the host (where you have a toybox test but a GNU chmod) but fails on Android where chmod is toybox too. Add the missing loop to string_to_mode(), which means this will also affect other toys, but that seems like a feature (and, for example, GNU mkdir also accepts a mode like `a=r+w+x`).
2020-11-29true is mentioned twiceFiras Khalil Khana
2020-11-27toysh: Adjust $0 for scripts.Rob Landley
2020-11-25Minor tweaks.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-18Fix microcom to set serial device's terminal correctly.Rob Landley
Can't use the same set_terminal() logic as ptys because it not displaying data, it should just accurately copy it.
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-17That last sh.c change had a lib/ change I forgot to check in.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-15Change test default to VERBOSE=fail, add all/quiet for old =1 and default.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-13Properly install toybox files with $TARGET suffixes.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-11Make the static musl x86-64 binaries segfault for fewer people.Rob Landley
Even though the gcc toolchain ./configure is told it's cross compiling, it optimizes for the current machine ANYWAY. So force it to be generic.
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-11-07xregcomp: add the specific regex we couldn't parse to the error message.Elliott Hughes
This makes it more likely that you can actually debug something like "sed: bad regex: empty (sub)expression" or "sed: bad regex: parentheses not balanced" from a build failure log, where you don't necessarily know where the failure came from. This also seems like it might be useful generally, although GNU grep doesn't include this detail in its error messages, and busybox doesn't even seem to notice that regcomp() failed? (Realistically if the Android build team wants to move forward with "one true regex implementation", we're going to have to add some GNU-isms to the Android regex implementation. But we'd need to find them first! Note that the two examples given above are real examples from failed buildbot builds, but they occur early in the respective builds so there are likely many more to look at after these. Interestingly, the first of the two appears to be the more general case of something disallowed by POSIX that xregcomp() already has a workaround for.)
2020-11-06portability.h: ensure _FILE_OFFSET_BITS=64 takes effect.Elliott Hughes
I added a #include above this, which caused subtle breakages on 32-bit systems. Move it to the top of the file to fix it and avoid making a similar mistake in future.
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-24Tweak release notes.0.8.4Rob Landley
2020-10-24Silence kernel messages that stomp the command line after boot.Rob Landley
2020-10-24Don't "quiet" the kernel builds. You can KARGS=quiet if you like.Rob Landley
2020-10-24Past time for 0.8.4Rob Landley
2020-10-24Just the FAQ's, ma'am.Rob Landley
2020-10-23Fix endless recursion bug on nommu for sh -c 'echo $(echo)'Rob Landley
2020-10-22Fix thinko.Rob Landley