Age | Commit message (Collapse) | Author |
|
|
|
|
|
It turns out that zlib defaults to just copying data verbatim if the
input isn't in gzip format, rather than rejecting it. Explicitly add a
check that zlib isn't doing that. (The toybox inflation path already
errors out.)
Also add the missing test.
|
|
Add basic smoketest while we're at it.
|
|
|
|
|
|
None of the current tests are relevant on the Mac because small
symlinks are inlined into inodes, as are empty directories, so
everything's using zero blocks.
|
|
|
|
::2 can legitimately be part of an IPv6 address, causing the test to
fail because the grep matches an unrelated part of the output. Be more
explicit about what we're actually searching for (as the previous test
already was) to avoid flakiness.
|
|
|
|
The Mac iconv_open(3) doesn't follow Unicode TR#22 rules for charset
alias matching that bionic and glibc do (and, strictly, POSIX doesn't
say you have to even though it's obviously a good idea), so we have
to say exactly "UTF-8" rather than "utf8".
Additionally, the 2006-era bash 3.2 on current versions of macOS
(because it was the last GPLv2 bash) seems to have bugs that cause
it to mangle UTF-8 input, so we can't reliably echo a UTF-8 sequence
into a file. Use \x in the tests to work around this.
|
|
BSDs call the root group "wheel" instead.
Also remove the duplicated "id id" from the progress output.
|
|
|
|
/proc/self/exe doesn't exist, but $C already gives us the path to
the binary. /dev/full doesn't have any equivalent afaik, so skip
that test if /dev/full is missing.
|
|
Check that the filename we fed in is output to stderr.
|
|
Includes new tests.
|
|
This was failing on macOS because it was calling the system env(1).
|
|
|
|
Bug #69 was fixed recently by commit
0b2cfcb8fdea9673f3c2e0940f1b16d5825e16ea. Add the two tests from the
bug so we can close it out.
Fixes #69.
|
|
glibc doesn't set errno when getpw* fails, so the perror_exit() looked
fine. bionic sets ENOENT and the trailing "No such file or directory"
looks silly, so switch to error_exit().
Additionally, the default format tests fail on Android because of
SELinux (but for a different reason than usual!). There's no id
--no-context flag, so use sed to just throw away any SELinux context.
|
|
The previous patch broke -nG, so move the -G code back to showone()
which handles -n.
Add the missing tests for the various uses of -n.
Also refactor the code to avoid the need to test optflags directly.
|
|
variable declarations go at the start of blocks, and remove specific
people's names from todo items (anybody can do any todo).
|
|
Handle unknown groups (fixes #117).
Fix -G to show *all* groups, not just all supplementary groups.
Fix -Z output to not include "context=".
|
|
Fall back to converting the "name" to an integer and calling getpwuid().
We need to update `username` for the later call to getgrouplist().
Also fix the separator printing logic to avoid a trailing ',' on `id 0`.
Switch to FLAG() and move some declarations down to where they can be
initialized, both for clarity.
Also add simple tests. Sadly, there's no always-present user that is in
multiple groups.
|
|
These tests ensure we follow the behavior of other `ls` commands, in
the basic case.
|
|
|
|
|
|
|
|
Reason: unicolumns() does not print combining characters correctly
Combining characters follow the character which they modify.
https://www.cl.cam.ac.uk/~mgk25/unicode.html#comb
xterm renders cut test1.txt -C -1 now correctly
|
|
And a few small cleanups while I was there.
|
|
back when they haven't specified -s, add tests.
|
|
89a8d00e470f1999a62ceea81269af2f39c655ba broke -E by switching to a prefix
match. 4e0d246ec98f2576d52eb5fd70cd6e86d542e2e4 fixed it again. Add the
missing regression test.
|
|
|
|
|
|
Inline array becomes garbage outside the if.
|
|
and silence "killed" messages from the shell by forking in a subshell.
|
|
Don't run the command with no arguments if we run out of input but
have already run the command at least once. The implementation of "run
the command at least once (unless -r was supplied)" wasn't taking into
account whether or not this was our first time round the loop.
Fix the exit value, and the -- already documented but not implemented --
behavior if a child exits with status 255.
Also extend the tests to cover these cases, plus cases I broke while
coming up with the fix. Add more tests to convince myself that we've
correctly interpreted how -s is supposed to behave, and fix the corner
cases at the bottom end of the range.
This fixes some issues we were seeing trying to build the Android SDK
for (and more importantly, on) macOS.
|
|
I must have lost this line somehow when I moved the patch from my AOSP
tree to a toybox tree. (But the ln tests passed on the host because I
was using coreutils ln there :-( )
|
|
Just re-tar the extracted file and check we get the expected result.
|
|
|
|
|
|
then pgrep finds child that hasn't exec("sleep") yet. So add 1/10 sec sleep
to let exec() happen before pgrep.
While we're there fix spurious "terminated" messages and reorder test file
creation so it fits in 80 columns.
|
|
|
|
|
|
|
|
|
|
There's nothing to stop a subprocess from catching our SIGTERM on timeout
and exiting, causing us to incorrectly report that it didn't time out.
Android's ART has a utility that does exactly this.
Explicitly catch this case, and add corresponding tests.
Bug: http://b/141007616
|
|
Two more spacing bugs here, one before the security context for -Z, and
one after the size with --full-time.
Before:
$ ./toybox ls -lZ --full-time Config.
-rw-r----- 1 enh primarygroup? 56162019-09-07 21:09:32.892215100 -0700 Config.in
After:
$ ./toybox ls -lZ --full-time Config.
-rw-r----- 1 enh primarygroup ? 5616 2019-09-07 21:09:32.892215100 -0700 Config.in
|
|
I think when I wrote this I tested the named escapes like \n and hex
escapes, and when I found \x wasn't supported I didn't even think of
octal. And I only learned about \c when I was looking at echo and printf
to compare their escape implementations a few weeks back.
Add the missing escapes and corresponding tests.
Fixes #139.
|
|
This broke a netd test (but sadly in postsubmit rather than presubmit).
Also add a trivial test that would at least have caught this bug.
Bug: http://b/140453237
|