aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-08-27Add ASAN=1 to the build, in a slightly different way than Elliott suggested.Rob Landley
I put it in configure, with the other environment variables, instead of in scripts/make.sh. Here's Elliott's original commit comment: ========== Just use `ASAN=1 make test_grep` or whatever. You'll probably want to set $ASAN_SYMBOLIZER_PATH to point to llvm-symbolizer, but Debian makes that annoying by calling the symbolizer /usr/bin/llvm-symbolizer-4.0 or whatever, and ASan refuses to use it: ==43370==ERROR: External symbolizer path is set to '/usr/bin/llvm-symbolizer-4.0' which isn't a known symbolizer. Please set the path to the llvm-symbolizer binary or other known tool. My usual workaround for this is to drop an llvm-symbolizer symlink in the current directory, and I'm happy to automate that in the script to make it require no knowledge of any of this nonsense, but haven't done so in this initial patch. I tested that this is actually working by reverting the grep fix and running `ASAN=1 make test_grep`.
2019-08-26xargs: add --max-args synonym, -o option, and fix -p.Elliott Hughes
The Linux kernel uses the --max-args synonym for -n. Barbarians who use vi need xargs' -o to be able to do something like: find -name xargs.c | xargs vi # Sad vi. find -name xargs.c | xargs -o vi # Happy vi. The -p option needs fixing to read from /dev/tty because stdin is otherwise occupied in xargs. I think xargs is the only place that needs this, so it didn't seem sensible to make all callers to yesno() be specific about which they wanted, hence the new function. Also remove the documentation for the build-time XARGS_PEDANTIC option which isn't actually implemented. Also add a TODO for -P (which is used by at least one script in the Linux kernel).
2019-08-26Try to make ls failure more graceful. Print ? ? ? entries instead of error msg.Rob Landley
Tweak DIRTREE_STATLESS so it returns zero stat for any error (I'm testing that dev, ino, and blksize are all zero), and fill in file type from readdir()
2019-08-23man: fix help, align -k output, and fix double close.Elliott Hughes
The "info" pages are something very different from the "intro" pages :-) do_lines already closes the fd. Also improve the error message for `man`.
2019-08-23getconf: remove workaround for old NDKs.Elliott Hughes
macOS remains awkward, though, but this retains our Android/Linux behavior and is closer to the platform's getconf(1) for macOS. Strictly macOS denies all knowledge of UIO_MAXIOV, but the "undefined" you'll get from this patch seems closer than the "1024" we used to give.
2019-08-23rm: error message consistency.Elliott Hughes
Before: $ ./rm rm: Needs 1 argument $ ./rmdir rmdir: Needs 1 argument (see "rmdir --help") After: $ ./rm rm: Needs 1 argument (see "rm --help")
2019-08-23Trivial style fixes while I was looking at main anyway.Rob Landley
2019-08-23Fix "ln -s toybox potato; ./potato" unknown command problem.Rob Landley
(Commit 7771e94e2a08 broke it.)
2019-08-22Add scripts/mkroot.sh and makefile changes for "make root".Rob Landley
Not in help text yet. Needs sh and route enabled in pending to do much. todo: work through the scripts/install.sh $PENDING list and add native toolchain support.
2019-08-22Quiet "make clean" so it doesn't fill a whole screen with output.Rob Landley
2019-08-21Add some 2>/dev/null to tests that produce gratuitous stderr output.Rob Landley
2019-08-21Add xgetline (which the last sh checkin used, oops).Rob Landley
2019-08-21Fix the unshare probe.Rob Landley
2019-08-19Tiny cleanup, net two lines shorter.Rob Landley
2019-08-19Fix bad test.Rob Landley
2019-08-19echo/printf: expand test cases, fix \x corner cases.Elliott Hughes
The behavior with "\xAV" (where the second hex digit is invalid) is different from the behavior with "\xVA", and echo and printf differ from each other.
2019-08-18Next round of shell plumbing.Rob Landley
You can now run: echo hello; if true; then echo hello; fi; while true; do echo hello; done It's got the start of for loops but needs environment variable resolver to do much with them.
2019-08-15Fix two typos.Elliott Hughes
2019-08-15Switch makedevs to new GLOBALS naming.Rob Landley
2019-08-15find.test: allow any error message about symlink loops.Elliott Hughes
glibc says "Too many levels of symbolic links", but BSD says "Too many symbolic links encountered". Until it becomes a problem, allow any error message.
2019-08-15dd: fix skip= with short reads.Elliott Hughes
Subtract the amount we actually read, not what we asked for.
2019-08-15linestack.c: fix buffer length.Elliott Hughes
GCC 8.2 (which my laptop appears to have been quietly upgraded to) points out that the %04X of an int might actually take 8 characters; between that, the "U+", and the trailing NUL, we're gonna need a bigger boat...
2019-08-13Return md5sum/sha1sum to the slightly slower but more explicit versionRob Landley
(revert afe951b19c0f with the table of magic constants). If you want speed, there's already a config option to use the libssl version instead.
2019-08-12find.test: fix flakiness.Elliott Hughes
Don't depend on directory iteration order in a test.
2019-08-12sort: move off get_rawline.Elliott Hughes
This was the last user of get_rawline, which lets us remove it.
2019-08-12blkid: add -s, SEC_TYPE, f2fs LABEL, and fix vfat/ntfs UUID.Elliott Hughes
This gets the tests passing with both toybox and util-linux 2.32.1 blkid. We use -s to get around the fact that we still don't support ntfs' $VOLUME_NAME attribute.
2019-08-09blkid.test: match TEST_HOST expectations.Elliott Hughes
Missing SEC_TYPE for ext3, msdos, and vfat. Missing LABEL for f2fs and ntfs. Wrong endian of UUID for msdos, ntfs, and vfat.
2019-08-09find: fix dangling symlink behavior.Elliott Hughes
ENOENT is ignored, but other errors are reported.
2019-08-09lsof: simplify octal mode display.Elliott Hughes
Since this masks, it doesn't actually have the same bug as e5942a8c90c2f52550496fdf08efddb564d8e5a3, but we may as well fix the other example of that questionable idiom while we're thinking about it...
2019-08-09losetup: fix the race.Elliott Hughes
There's a race between LOOP_CTL_GET_FREE and LOOP_SET_FD. Work around it by just retrying if we get EBUSY on the LOOP_SET_FD call. This is what similar code in ChromeOS already does. Bug: http://b/135716654
2019-08-09Split out run_function() and free_function(), add start of _TOYSH_LOCALSRob Landley
marshalling for vforked subshells, fix rc returned from run_pipeline for variable assignment. (Well, sort of: X=$(false) still needs rc = 1.)
2019-08-05du: disable the tests if we have SELinux.Elliott Hughes
ext stores extended attributes in a way that makes all the numbers in the test incorrect. For now, just disable the test in that case.
2019-08-04Make "if true; then echo hello; fi" work. More work on redirection.Rob Landley
2019-08-04Add TOYFLAG_MAYFORK and annotate a couple commands.Rob Landley
A TOYFLAG_NOFORK command must run in the context of toysh, but a MAYFORK can either run standalone or run in the toysh process. MAYFORK means it cleans up after itself: no leaked resources (malloc, mmap, filehandles, etc), even in error_exit() paths that would longjmp() back to the shell. It also doesn't discard anything we need to retain (don't close stdout, change toys.optargs[] so we can't free it, etc)...
2019-08-03Fix a bug report from E5ten: stat of a file with suid or sticky bit setRob Landley
output 5 digits of octal stat data instead of 4, due to hardwired leading 0 instead of %04a sprintf prefix.
2019-08-02Next round of infrastructure. Start of redirect logic and runtime flow control.Rob Landley
2019-08-02fix parallel make build failurePatrick Oppenlander
make: *** No rule to make target 'generated/Config.probed', needed by 'Config.in'. Stop. make: *** Waiting for unfinished jobs....
2019-08-02fix typo in MakefilePatrick Oppenlander
2019-07-31Move the empty regex workaround into xregcomp.Elliott Hughes
No current caller except grep needs this, but consistency seems like a good idea. Also change the xregcomp error message to be a bit more human-readable, rather than mention an implementation detail.
2019-07-31Fix error path and tweak comments.Rob Landley
2019-07-31man: switch to xregcomp.Elliott Hughes
All regcomp callers are now going through xregcomp.
2019-07-30Fix signed typecast bug.Rob Landley
We use (char *)1 and (char *)2 to indicate errors (they can never be valid pointers because both malloc() and mmap() return aligned memory and those align down to NULL, plus Linux maps 4k at the bottom to catch null dereferences anyway), and then typecast it to long (trusting in LP64) to do an integer <=2 comparison... except that needs to be UNSIGNED long or else pointers in the top half of the virtual memory space become negative and the <=2 false positives them as errors. (Oops.)
2019-07-29grep: fake GNU behavior for non-POSIX empty regex.Elliott Hughes
POSIX says there's no such thing as an empty regular expression. The grammar excludes the possibility: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html BSD agrees with POSIX, and Android and macOS' BSD-based implementations reject the empty regular expression. GNU apparently disagrees. Luckily, BSD does accept the empty *sub* expression `()`, despite their error message for REG_EMPTY being "empty (sub)expression". This is presumably a bug, except there's explicit code to support it that is at least 26 years old: https://github.com/freebsd/freebsd/blame/master/lib/libc/regex/regcomp.c#L383 This workaround also works fine with glibc. If we want GNU behavior, I'm struggling to come up with another way to fake it. If we want POSIX behavior, we could easily just add a check to reject "" on glibc. Also switch to xregcomp().
2019-07-29Add ASAN=1 to the build system.Elliott Hughes
Just use `ASAN=1 make test_grep` or whatever. You'll probably want to set $ASAN_SYMBOLIZER_PATH to point to llvm-symbolizer, but Debian makes that annoying by calling the symbolizer /usr/bin/llvm-symbolizer-4.0 or whatever, and ASan refuses to use it: ==43370==ERROR: External symbolizer path is set to '/usr/bin/llvm-symbolizer-4.0' which isn't a known symbolizer. Please set the path to the llvm-symbolizer binary or other known tool. My usual workaround for this is to drop an llvm-symbolizer symlink in the current directory, and I'm happy to automate that in the script to make it require no knowledge of any of this nonsense, but haven't done so in this initial patch. I tested that this is actually working by reverting the grep fix and running `ASAN=1 make test_grep`.
2019-07-27losetup.test: bail out if loopback devices are already in use.Elliott Hughes
There's probably a way to filter out the existing ones, but it's likely to be pretty painful and isn't immediately necessary. (I hit this case on Android cloud x86 devices.)
2019-07-27modinfo.test: bail out early if there are no modules.Elliott Hughes
We need /proc/modules *and* a directory of modules.
2019-07-27ifconfig.test: actually skip tests if dummy0 up fails.Elliott Hughes
Rather than just claim we're doing so. Android cloud emulators don't have dummy0 like regular devices do.
2019-07-26truncate.test: work around ext extended attributes space usage.Elliott Hughes
Weaken the test slightly so that the extra 4KiB used for SELinux is ignored. Unfortunately all the du tests suffer the same problem, and I'm less sure what to do there. Mounting a read-only file system without the extended attributes might be the best idea? But since this test modifies the file system...
2019-07-26hostname: fix tests for non-root on Android.Elliott Hughes
On Android you can't even get the hostname unless you're root, to avoid device fingerprinting/tracking. Also modernize by using skipnot, which fixes the incorrect test name in the SKIP: output.
2019-07-25killall: implement -w.Elliott Hughes
This isn't currently used in AOSP, but it is used in some of the other codebases I can easily search, and it's a better fix for test flakiness than inserting a sleep.