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.
|
|
When we "losetup" success need mount loop device.
Found this issue on AndroidQ
|
|
The <netdb.h> functions have their own errno :-(
|
|
and cleanup hostname to only call gethostname() once.
It passes the one test in test_hostname, if that helps.
|
|
Add mock gzip -n to satisfy pkgsrc.
|
|
|
|
If you accidentally configure the sha-3 sums on, but don't enable
libcrypto, you'll get toys that just output md5 sums instead. This patch
doesn't cause a build-time error (my original plan), but does at least
ensure that toybox refuses to include incorrect sha-3 sum
implementations.
|
|
(revert afe951b19c0f with the table of magic constants). If you want speed,
there's already a config option to use the libssl version instead.
|
|
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.
|
|
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.
|
|
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.
|
|
Include all the signals, not just the POSIX ones.
In particular, improve support for real-time signals. My attempt to
switch AOSP builds over to toybox timeout got reverted when I broke the
ART build bots which use SIGRTMIN+2.
Also fix `kill -l 3` to show "QUIT" and `kill -l QUIT` to show "3".
Also make the `kill -l` output include numbers and names, and format it
to look better on a 80x24 tty, because it's always August 1978 somewhere.
|
|
|
|
The permissions preservation test still fails for me, but that seems to
be because my environment changed: it's failing because of my umask.
I'll fix that in a separate patch, since it's unrelated.
|
|
|
|
|
|
|
|
|
|
More consistent tense, capitalization, and punctuation. A few commands were
missing an introductory line, so I copied those from the first comment
line.
|
|
|
|
|
|
Only -d and -f should cause a DNS lookup. The rest should just act
directly on the result of gethostname(3). Encountered with the AOSP
buildbots' use of nsjail, but tested with both the Debian hostname and
toybox hostname thus:
```
unshare -Uunr sh
hostname android-build
hostname
hostname -s
hostname -d
hostname -f
```
(Not sure how to add that to the tests.)
Also fix a SEGV with -s if the hostname doesn't contain a '.'.
Also switch to the FLAG() macro.
Also add the missing -s to the synopsis.
Bug: http://b/123123255
|
|
Annoyingly coreutils and busybox both have the --status functionality,
but coreutils only accepts --status and busybox only accepts -s. Although
all extant users known to me use --status I've supported both (a) for
maximum compatibility and (b) because Rob hates longopts :-)
Also, -c/--check don't take argument(s): they alter the interpretation
of all the FILE... arguments.
I removed a bunch of dead code here, but I couldn't switch us over to
loopfiles_lines because I didn't want to regress on the "warn if any
check file contains no hashes", and loopfiles_lines doesn't give you
any way to recognize that you've moved on to the next file.
|
|
|
|
Be consistent about upper versus lower case. (Upper seems to have the
majority, so I went with that, though I'm happy to provide the opposite
patch as long as we're consistent!)
Be consistent about using \t. (Though saving a few bytes seems like it
might be better done in the code that generates help.h rather than
directly in the source, since tabs make careful ASCII art layout hard
enough that we regularly have things misaligned.)
Remove trailing periods (most of which seem to have been added by me).
Always use the US "human readable" rather than my British
"human-readable", and be more consistent about declaring whether we're
showing multiples of 1000 or 1024.
Just say "verbose" rather than adding a useless "mode" or "output".
|
|
I realized (after being questioned about my motivation) that I hadn't
added a test for the -u behavior. Adding the missing test confirmed the
usual "if there isn't a test, the code is broken", but now I think I
actually understand how we're supposed to choose between DIR, $TMPDIR,
and /tmp. I've added more tests to back this up, and rewritten the code
one more time so that we pass all the tests.
|
|
Old versions of glibc had warn_unused_result on mktemp(3), despite it
always returning its argument. Still, we can silence the warning and
save a line, so...
|
|
The new tests pass on the host (coreutils 8.28) and with toybox after
this patch is applied.
|
|
bionic, glibc, macOS, and musl all have strcasestr
(see http://man7.org/linux/man-pages/man3/strstr.3.html).
macOS (via BSD) has a strnstr that does what strnstr sounds like it
should do by analogy with strnlen and strncpy.
So we at least need to rename strnstr, but it probably makes more sense
just to switch to strcasestr instead.
|
|
|
|
|
|
|
|
At least the AOSP build doesn't try to _set_ the hostname...
|
|
|
|
Josh Gao hit a case where "seq 1000000 1000001" output 1e+06, and while he
was there changed several things to work like existing seq implementations.
I changed a couple back (commenting out the test cases) until somebody
came come up with a reason (or existing use case) to do it that way.
|
|
flag doesn't get set right otherwise and it tries to overmount instead.
|
|
|
|
|
|
|
|
|
|
to unify the two codepaths in Elliott's rewrite.
|
|
I never use these, so I didn't notice I'd broken them until someone who
does bringup complained.
The "one weird trick" with SEEK_DATA is documented at the URL we already
point to. SEEK_DATA was added in Linux 3.1 (2011) and isn't available in
glibc 2.19 (2014), so I've added that to "portability.h" for the benefit
of Ubuntu 14.04.
Also make -c and -C mutually exclusive.
Also fix some of the formatting I introduced earlier. (A clang-format file
would help prevent these mistakes...)
|
|
|
|
from incrementing by a double.
|
|
|
|
Annoyingly, this means writing a new dmesg implementation that uses /dev/kmsg
rather than the klogctl system call. Worse, pre-3.5 kernels don't support
that, so we need to keep the old implementation around as long as we still
care about those kernels.
Since I'm here, add the fancy colors from modern dmesg and the -C flag.
Tested on Nexus 9's 3.10 kernel, an Ubuntu 3.13 kernel, and the
Nexus One's 2.6.35 kernel.
|
|
|
|
a patch from Elliott Hughes, who said:
[PATCH] Add support for libcrypto for MD5/SHA.
Orders of magnitude faster (for architectures where OpenSSL/BoringSSL
has optimized assembler).
Also adds sha224sum, sha256sum, sha384sum, and sha512sum for folks
building with libcrypto.
The fallback portable C implementations could easily be refactored
to be API-compatible, but I don't know whether they'd stay here or
move to lib/ so I've left that part alone for now.
|
|
|
|
|