Age | Commit message (Collapse) | Author |
|
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
|
|
|
|
The first bug appeared as a memory overwrite, but was actually visible
without hwasan: basically any `grep -F` that let to multiple matches on
the same line was broken.
The second bug was another memory overwrite, visible when I ran the
existing grep tests.
Bug: http://b/137573082
|
|
This fixes the extended attribute settings for the ip route change
command; extended attributes are collected in a separate buffer
and added to the RTM message in a specific RTA_METRICS attribute.
Only added setter support for the RTAX_MTU (per-route MTU), as that
was the only option currently parsed.
Also added support for displaying extended attributes, even those
not currently settable.
|
|
Pointed out during code review of the recent refactor.
|
|
Used by some ART tests and also some LLVM tests. (The motivating example
is the latter, but I noticed the former when looking for other users.)
Bug: http://b/137298656
|
|
Before this patch, we're effectively doing `pidof -x` all the time. This
patch changes names_to_pid() to allow us to say whether or not we want to
include scripts, and adjusts the callers appropriately.
Also add tests for `pidof` versus `pidof -x` which pass after this
patch, without regressing the existing killall tests.
|
|
On BSD these are actually the same, and there's a -S that you need in
addition. So strictly this is a behavior change for Android (which is
going from BSD grep to toybox grep), but it's a behavior preserving
change for the AOSP build (which is going from GNU grep to toybox grep),
and the latter actually has a checked-in use of -R where the former
doesn't.
|
|
|
|
Rename the existing xbind/xconnect to xbindany/xconnectany, to make room
for new xbind/xconnect that are more like 'x' versions of the regular
bind and connect. Move explicit bind/connect callers over to
xbind/xconnect.
Of the affected commands, only netcat is actually used by Android. It
was the most recent patch to netcat that made the lack of a more
traditional xbind/xconnect apparent.
|
|
The other xargs implementations in the wild don't seem to count the
space taken by each `char *`. Go for bug compatibility unless future
experience proves that to be a bad idea.
|
|
The test relied on the non-builtins not being toybox (or another
multicall binary). A multicall binary will actually look at the
symlinked name (in this case "true") and do what it says on the tin.
Use a tiny shell script instead.
|
|
Investigating why the toybox tar tests fail on Android with toybox dd, I
realized I was rewriting a part of dd I'd rewritten before!
This is a re-send of my 2019-02-22 patch, rebased against the current
ToT...
This patch was originally motivated because after suggesting to the author of
https://stackoverflow.com/questions/17157820/access-vdsolinux/54797221#54797221
that he could tell dd to work in bytes rather than blocks, I realized
that our dd doesn't actually support that. But the rewrite of the main
loop is necessary to fix the incorrect output from the dd calls in the
tar test.
Without this patch, `yes | dd bs=65536 count=1 > fweep` basically gives
random output, based on how many bytes the pipe feels like giving you in
your first read. (As far as I know, dd *without* bs= was fine, but I
can't guarantee that that's true, just that I haven't seen it fail.)
Also switch to TAGGED_ARRAY and comma_* for conv rather than add two more
copies of an undesired idiom. It turned out -- contrary to the belief of
cp(1) -- that comma_scan isn't suitable for this because of its magic
handling of "no" prefixes. (It's actually harmless in cp because none
of the --preserve options begin with "no", but some dd options do.) To
this end, comma_remove is a less-magic comma_scan.
I've also changed an `if` to a `while` because other implementations
allow things like `--preserve=mode,mode` or `conv=sync,sync`. (If we
decide this is a bug rather than a feature, we should at least fix the
error message to be clear that we're rejecting the *duplication*, not
the option itself.)
I've also fixed the ^C behavior by simply adding a direct SIGINT handler
rather than trying to be clever inside the read loop (which is why we
weren't handling the SIGINT until the read returned).
I've also removed `strstarteq` and just added the '=' to each literal
when calling regular `strstart`.
Plus basic tests.
|
|
|
|
|
|
"xz compressed data" was missing a newline. Also switch a couple of
other unnecessary (but correct) xprintf calls over to xputs.
Also add .otf fonts, perf/simpleperf data files, and Android boot
images, sparse images, and device tree blobs/overlays.
|
|
Change names_to_pid() so that we can actually match shell scripts with
long names (the code to get the shell script's name was correct, but
there was an extra test preventing us from actually comparing it to the
sought name).
In kill.c itself, remove a dead test for -l and switch to the FLAG()
macro.
Also extend the tests to explicitly cover long and short names.
|
|
These tests don't work for me as root on either my Debian desktop or my
Android devices. The original mail thread implies that they were as
close as the original comitter could get to _something_ that seemed to
work, even if the kernel doesn't seem to bother with this:
http://lists.landley.net/pipermail/toybox-landley.net/2014-November/003795.html
toybox ifconfig *is* missing support for `-pointtopoint` and
`pointopoint` (without an addess), similar for `broadcast` according to
the man page. But since we don't appear to have a way to test this (other
than looking at strace output!) I'm leaning towards YAGNI anyway...
|
|
|
|
My app runs npm i -S better-sqlite3, and node-gyp-bin from the npm
upstream has #!/usr/bin/env sh, expecting the system shell.
|
|
Implement nl -v supporting negative and zero starting values.
|
|
Other implementations of netcat support UNIX domain sockets via -U, so
this change adds it to toybox too.
Example usage:
Create ./uds as a UNIX domain socket and listen on it, forwarding
messages to bash:
> nc -U -s ./uds -L /bin/bash
Connect to ./uds as a UNIX domain socket
> nc -U ./uds
|
|
|
|
I know that you are working on toysh which I'm looking forward to. In the
meantime below is a patch to improve compatibility with older/odd versions
of bash. This fixed a minor build issue I was having on MacOS (which was
using zsh in emulated bash mode) as well as an oddball embedded SDK using
a non-gnu version of bash. I believe these changes are minimal and should
be safe to apply, if not I wanted to at least get them on the mailing list
in case others ran into these issues.
|
|
Improve Android support (see code comments).
Remove unnecessary fixed-length limits.
Show error if module not found (plus test).
Expand help text.
Switch to FLAG macro.
Stop hard-coding module assumptions in the tests.
|
|
mksh doesn't support process substitution, so use an explicit temporary
file.
|
|
file now shows the target of a symbolic link and calls out broken
symbolic links.
file now shows the device type for block/character special files.
file now shows specific reason when it can't open.
stat now includes the device type, plus a little more space between the
number of blocks and the human-readable file type.
Adjusted tests accordingly, which actually makes more of them pass on
the host as a convenient side-effect, but I actually made these changes
because I've been finding the desktop file and stat output more convenient
in these cases.
|
|
I don't know why we fixed the other tests but not this one. Before this
patch it's failing with/without TEST_HOST. After this patch, it passes
both.
|
|
one in $PATH.
|
|
Use /dev/block/loop* more uniformly, and teach the tests which to expect.
|
|
|
|
The killall test still fails with toybox. Seems like right now killall
and pidof share name to pid logic, but playing about with the desktop
killall (which does pass this test), it seems like killall actually
behaves more like pgrep than pidof (which does seem to be this limited
on the desktop too)...
|
|
There's no /etc/passwd and /etc/group, but there are enough users and
groups that we can test with. ("bin" and "daemon" were added for LTP;
"shell" is what you get with `adb shell`.)
|
|
util-linux's blkid doesn't support reading from stdin, so move that to
being a special toyonly test rather than the default.
toybox blkid differs from util-linux in that it doesn't seem to find the
LABEL for the checked-in example f2fs file system (the offset is wrong,
but also f2fs uses LE16 strings), nor does it support the SEC_TYPE that
util-linux blkid shows for several of the test file systems.
|
|
Basic line continuation logic (to prompt with $PS2). Doesn't use result yet.
|
|
Fix `losetup -f` to not fail with an error.
Add the missing \n for `losetup -f --show FILE`.
Use decimal for the device number, like the desktop losetup.
Switch to the FLAG macro.
Make the tests runnable as tests, and expand coverage a bit. With this
patch, the tests pass both with and without TEST_HOST on the desktop.
Note though that this patch is part of fixing some real-life losetup
issues, not part of the "test cleanup" I'm also looking at. losetup is
low down that list!
|