Age | Commit message (Collapse) | Author |
|
|
|
|
|
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.
|
|
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.
|
|
|
|
|
|
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.
|
|
Subtract the amount we actually read, not what we asked for.
|
|
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...
|
|
(revert afe951b19c0f with the table of magic constants). If you want speed,
there's already a config option to use the libssl version instead.
|
|
Don't depend on directory iteration order in a test.
|
|
This was the last user of get_rawline, which lets us remove it.
|
|
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.
|
|
Missing SEC_TYPE for ext3, msdos, and vfat.
Missing LABEL for f2fs and ntfs.
Wrong endian of UUID for msdos, ntfs, and vfat.
|
|
ENOENT is ignored, but other errors are reported.
|
|
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...
|
|
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
|
|
marshalling for vforked subshells, fix rc returned from run_pipeline for
variable assignment. (Well, sort of: X=$(false) still needs rc = 1.)
|
|
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.
|
|
|
|
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)...
|
|
output 5 digits of octal stat data instead of 4, due to hardwired leading 0
instead of %04a sprintf prefix.
|
|
|
|
make: *** No rule to make target 'generated/Config.probed', needed by 'Config.in'. Stop.
make: *** Waiting for unfinished jobs....
|
|
|
|
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.
|
|
|
|
All regcomp callers are now going through xregcomp.
|
|
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.)
|
|
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().
|
|
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`.
|
|
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.)
|
|
We need /proc/modules *and* a directory of modules.
|
|
Rather than just claim we're doing so.
Android cloud emulators don't have dummy0 like regular devices do.
|
|
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...
|
|
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.
|
|
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.
|
|
And when I say "fix", I mean "hack around in the worst possible way".
Android+mksh is often slow enough that we can do the pgrep before the
killed process has actually exited. (I'm seeing roughly 100% failure
rate on cloud x86 emulators, and about 75% on a real Pixel 2.)
|
|
It turns out some Android devices have an empty /etc/passwd and/or
/etc/group, which was defeating the previous workaround. Switch to
testing the intention more directly: we'll try the file in /etc, and if
that didn't work, we'll assume we need a workaround.
|
|
Test: no EBADF in `strace -e close ./toybox tac /proc/version`
|
|
|
|
|
|
|
|
This was basically just to help me think out loud while discussing
loopfiles_lines().
|
|
I started this last night, but thought I'd aim to send multiple small
patches rather than work through all the callers and send one big patch.
I've deliberately chosen the ugly name `allocated_length` because we've
had historical bugs where folks think this a line length in the sense of
the return value. I do wonder whether we should actually have some kind
of getline() wrapper that hides the `char *`/`size_t` pair in lib/,
which makes the function easier to use in most cases but does add the
less common gotcha that you wouldn't be able to getline() through
multiple files at once (which does happen in at least one toy).
But maybe the real fix is to look harder for places where we can just
use loopfiles_lines? Speaking of which, should we actually add two more
arguments to that? Specifically: switch it to getdelim() rather than
getline() behind the scenes, and also add a way to have the trailing
'\n' automatically removed, since that seems to be what most callers
want?
Anyway, that seemed like enough questions that it was time to send this
initial patch out before doing too much more...
|
|
There's no /etc/group on Android.
Loop devices are in different places, but that test doesn't seem to
offer anything beyond the block/char special device tests later, so
remove that rather than fix it.
Fix the block/char special tests (the expectations were missing, but
they're never normally run on the host because the mknod fails).
Likewise add the missing expectation to the "ownership" test, which
isn't normally run on the host because the chown fails.
The "sparse without overflow" test was broken because of the mksh/bash
disagreement about whether in `VAR=val shell_function` that's a
temporary assignment to VAR or one that outlives the command. Switch SUM
to being a function like LST before it. Also rewrite the TARHD stuff
because Android (a) doesn't have hd and (b) doesn't have process
substitution in its shell. (I wish I'd noticed TARHD earlier --- I'd
been manually sending the tar files to xxd for debugging instead!)
With this patch, all the tar tests now pass for me on both the device
and host.
|
|
|
|
|
|
This was embarrassing... A build script that was using xargs -I silently
started to ignore -I when we switched over to toybox xargs. The owner of
the script has rewritten it to use the shell read builtin instead, but
it's pretty unhelpful to silently ignore an option that radically
changes how xargs behaves. (The -I behavior sounds sufficiently
different from normal behavior that I'm not sure I've understood, and am
just sending this cleanup rather than actually implementing -I correctly.)
Bug: http://b/137832162
|
|
The change from ioctl to xioctl in
844f0d1aae28c54bbb672f53ba2cda182c572129 broke ifconfig for non-root on
Android. SIOCGIFHWADDR has been protected to prevent device tracking
since Nougat.
Bug: https://issuetracker.google.com/137671590
|