aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-04-14Andy Chu pointed out an out of bounds access for zero length lines.Rob Landley
While we're at it, use unsigned for the line length.
2016-04-11sed -f - should read from stdin.Rob Landley
2016-04-10Didn't check in all my local basename_r->getbasename changes. (Oops.)Rob Landley
2016-04-09Jakob Flierl pointed out a broken URL in the README.Rob Landley
2016-04-08Redefining basename_r to mean something random seems popular (bionic and freebsdRob Landley
both did it) so use getbasename instead.
2016-03-30Whitespace and comment.Rob Landley
2016-03-30Implement mv -n / cp -n (no clobber).Andy Chu
This fixes a failing test case in mv.test. Test changes: - Add coverage for -i (interactive). - Better descriptions, better formatting, and removed some redundant cases.
2016-03-29Fix build when wchar_t is unsigned.Elliott Hughes
external/toybox/lib/linestack.c:84:5: error: conflicting types for 'crunch_str' int crunch_str(char **str, int width, FILE *out, char *escmore, ^ external/toybox/lib/lib.h:228:5: note: previous declaration is here int crunch_str(char **str, int width, FILE *out, char *escmore, ^ I'm not sure whether the interface was intended to be wchar_t or int, but switching to int is the smaller change...
2016-03-29Fix exit code of things like sed -i that use tempfile_handler().Rob Landley
(The sigatexit() handler list code now calls the handlers on the normal exit path, so _exit(1) from the handler is wrong; exit_signal() modifies toys.exitval if necessary.)
2016-03-25basename: fix segfault on null input; add testsSamuel Holland
When passed an empty string, glibc's basename() returns a pointer to the string "." in read-only memory. If an empty suffix is given, it fits the condition of being shorter than the path, so we try to overwrite the null byte and crash. Fix this by just ignoring empty suffixes; they don't do anything anyway.
2016-03-25Add od -w.Elliott Hughes
I'm not an od user myself, but I copy & pasted an 'od' invocation from a bug and it didn't work. Which was embarrassing because I'd just claimed that the od user didn't need to run od on their desktop (as they had done) and could have run it on the device instead...
2016-03-25toolbox prlimit is no more.Elliott Hughes
Replaced by toybox ulimit -p.
2016-03-24Debian bug 635570 did something horribly nonstandard (depending on a sideRob Landley
effect of "sed -e 'a\'" with no trailing line). But there's an actual user, and it's not hard to implement, and it's not hard to implement, and there isn't an obvious _other_ way to do it, so add the behavior and a test for it. Fix some bad/missing comments while I was there, and add a couple TODOs.
2016-03-23Fix bzcat.test (as noted by Andy Chu), wean tests off $TOPDIR and supply $FILESRob Landley
instead, move tests/blkid into tests/files/blkid.
2016-03-23The test infrastructure prints the command name now, so file.test shouldn't.Rob Landley
2016-03-23Minor blkid cleanup. (There was a while(ptr[-1]==' ') ptr--; that could fallRob Landley
off the start of the string. I pulled on the thread...)
2016-03-23Redo build stuff in response to Andy Chu's suggestions.Rob Landley
Toybox single binaries are now made directly with the new name instead of stomping toybox and getting renamed. Unstripped files now live in generated/unstripped. Target to run all tests is now "make tests" to avoid conflict with "make test". .singleconfig now has .PHONY: entries for all test_$NAME targets. Default install location changed to /usr/toybox, code.html now says how to change it (set $PREFIX). scripts/install.sh --uninstall works now. (And you get to keep the pieces!)
2016-03-22blkid: Handle short/empty vfat labels; update testsSamuel Holland
vfat labels have a fixed space allocated for them. In the case of a shorter label, the remaining bytes are padded with spaces. A vfat filesystem with no label (i.e. that will show up in Windows as "Local Disk (X:)" or "Removable Disk (X:)") is stored as "NO NAME ". Both of these changes match behavior from util-linux.
2016-03-20Posix requires "" to be false, and 00 should be false, and -0 should be false.Rob Landley
Fix memory leaks in regex. Simplify regex check (if we matched, subexpression had to match). Don't exit() from a command, set exitval and return.
2016-03-19Make lsof 10x faster by caching /proc/net socket info.Elliott Hughes
I deliberately didn't do this first time round because for me our lsof is already 10x faster than traditional lsof, and caching means we potentially give less information about a socket that's created while we're running. It turns out that traditional lsof caches anyway, so I guess nobody cares. This also fixes a mistake where lsof used CFG_FREE instead of CFG_TOYBOX_FREE.
2016-03-18Fix last commit (had newline before first ==> name <==) and add -f tests.Rob Landley
2016-03-18Fix "tail -f single_file".Josh Gao
TT.file_no was being incorrectly calculated as 0 when tail -f was passed a single argument.
2016-03-17expr cleanup: simplify get_str() and free returned allocations.Rob Landley
2016-03-17Remove 'exit' from xargs test too.Andy Chu
2016-03-17Fix bug where all tests aren't being run with 'make test'.Andy Chu
The tests/*.test files shouldn't explicitly exit, because they are sourced in scripts/test.sh. No tests after sed were being run.
2016-03-16expr cleanup: traverse optargs with tok instead of incrementing optargs andRob Landley
copying itinto a second variable. Also add error message for empty ( )
2016-03-16Move whitespace and curly brackets around, move reference URLs to top of file,Rob Landley
eliminate syntax_error() function (just call error_exit() directly), eliminate advance() wrapper, pipe expected error messages in test to /dev/null
2016-03-16Fix type coercion bugs in expr.Andy Chu
All tests pass now; this fixes the 2 remaining failures, including a segfault. The structure of the code has changed a lot -- instead of having a tiny function per operator, we have eval_op() which does common type coercion and then evaluates the operator. I tried writing it a couple different ways, and this was the cleanest. The OPS table now contains the operator string, precedence level, signature for type coercion, and operator ID.
2016-03-16Fix the operator precedence in expr.Andy Chu
expr now uses the precedence table specified by POSIX, implemented using the "precedence climbing" algorithm. See the references at the top of eval_expr(). This fixes 3 of 4 failing tests. I also added more tests for correct behavior and for syntax errors. This includes a new test exposing a segfault, related to type coercion.
2016-03-15Add base64.test, and Izabera pointed out that -w0 should disable wrapping.Rob Landley
2016-03-15Add ls -b and make ls -q work with utf8.Rob Landley
2016-03-13Split out _xexit() from xexit() and give sigatexit() multiple callbacks.Rob Landley
2016-03-13factor: use long long math (64 bit on 32 bit platforms) and handle negativeRob Landley
numbers even though we use unsigned math now.
2016-03-12Update scripts/single.sh and cp.c so "make mv" isn't actually building cp.Rob Landley
2016-03-12The xattr functions were added during the 2.5 kernel, lsm.h can #include theRob Landley
header unconditionally. (This fixes the warning when CP_PRESERVE disabled.)
2016-03-10Fix segfault in sed -e 'c\'.Andy Chu
Found by afl-fuzz.
2016-03-08Add depends on TOYBOX_FORK for various commands that need nommu conversion.Rob Landley
(This should fix allyesconfig.)
2016-03-07Cleanup pass on the dirtree infrastructure, in preparation for making rm -rRob Landley
handle infinite depth. Fix docs, tweak dirtree_handle_callback() semantics, remove dirtree_start() and don't export dirtree_handle_callback(), instead offer dirtree_flagread(). (dirtree_read() is a wrapper around dirtree_flagread passing 0 for flags.)
2016-03-06Fix warning (toys.optflags is a long long now).Rob Landley
2016-03-06wget: clean upLipi Lee
- shorten error messages - replace mk_rq with sprintf - remove struct and defines - change unsigned int to unsigned
2016-03-06Another pass at file.c: move posix-required "executable" to front of output,Rob Landley
next few fields in the order the other implementation outputs, fewer commas, fix a big where big endian executable type wasn't detected right, and fix the filehandle leak.
2016-03-04Elliott pointed out that we output "unlimited" instead of "infinity", soRob Landley
accept that as input. (And that I screwed up the test.)
2016-03-03Fix bzcat integer overflow reported by John Regehr.Rob Landley
2016-03-02Fix file for Java class files, improve script detection, and add tests.Elliott Hughes
2016-03-02More minor cleanup (inline a function, simplify name of another).Rob Landley
2016-03-02Minor cleanup.Rob Landley
2016-03-02Fix base64 so == wraps properly.Rob Landley
2016-03-02Factor out command name at the start of test name, have runtest.sh print it.Rob Landley
2016-03-02Print command name at start of each test.Rob Landley
2016-03-02Split lsattr/chattr tests.Rob Landley