aboutsummaryrefslogtreecommitdiff
path: root/toys/lsb
AgeCommit message (Collapse)Author
2019-10-12hostname: fix error reporting.Elliott Hughes
The <netdb.h> functions have their own errno :-(
2019-10-08Add dnsdomainname, fix "hostname -d" segfault on machine with no domain name,Rob Landley
and cleanup hostname to only call gethostname() once. It passes the one test in test_hostname, if that helps.
2019-09-23noop gzip -n.Denys Nykula
Add mock gzip -n to satisfy pkgsrc.
2019-09-17Allow --tmpdir's argument to be optional.Rob Landley
2019-09-07md5sum: don't allow broken sha-3 sums.Elliott Hughes
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.
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-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.
2019-07-12pidof: fix default behavior, add -x.Elliott Hughes
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.
2019-07-06killall: better handling of long names.Elliott Hughes
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.
2019-06-10Improve signal name<->number conversions.Elliott Hughes
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.
2019-04-26gzip: fix permissions perservation despite umask.Elliott Hughes
2019-04-26gzip: fix regressions caused by 7964e1f78b58d9c365361cc36b0422d9d56cd204.Elliott Hughes
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.
2019-04-22Ahem: _decompression_ is ready, compression isn't yet. Change defconfig y/n.Rob Landley
2019-04-21Promote gzip/zcat but keep gunzip default n until lib/deflate.c finished.Rob Landley
2019-03-09Half-finished su change checked in, sorry.Rob Landley
2019-03-07Add reset_env() and make su and login use it. Do long-delayed login cleanup.Rob Landley
2019-03-02Improve help consistency.Elliott Hughes
More consistent tense, capitalization, and punctuation. A few commands were missing an introductory line, so I copied those from the first comment line.
2019-02-23Add UUID= support to mount, via blkid -U.Rob Landley
2019-02-23Switch mount to use FLAG() macros.Rob Landley
2019-01-19hostname: fix behavior when in jail.Elliott Hughes
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
2018-12-19md5sum/sha1sum: add --status and --check, fix --check with multiple files.Elliott Hughes
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.
2018-12-07Fix mktemp to pass tests.Rob Landley
2018-12-04Clean up some --help formatting.Elliott Hughes
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".
2018-12-04mktemp: more tests, more fixes.Elliott Hughes
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.
2018-12-03mktemp: fix warning with glibc 2.15.Elliott Hughes
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...
2018-11-28mktemp: add -t and fix behavior.Elliott Hughes
The new tests pass on the host (coreutils 8.28) and with toybox after this patch is applied.
2018-11-28macOS: replace local strnstr with strcasestr.Elliott Hughes
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.
2018-11-20Eduardas Meile asked umount to ignore -c due to broken init systems.Rob Landley
2018-11-19A few more GLOBALS() single character argument style conversions.Rob Landley
2018-11-17Convert more GLOBALS argument vars to the new single letter code style.Rob Landley
2018-11-17hostname: add -s/-f and -d.Elliott Hughes
At least the AOSP build doesn't try to _set_ the hostname...
2018-06-29Cleanup pass on passwd, needs more testing.Rob Landley
2017-09-09Redo/add seq precision logic.Rob Landley
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.
2017-07-11Don't remove "remount" from the option list during early parsing, the mountRob Landley
flag doesn't get set right otherwise and it tries to overmount instead.
2017-06-09Promote dmesg back to lsb.Rob Landley
2017-05-27Replace two space indents with tab indents in help text (for consistency).Rob Landley
2017-05-26Be more consistent about periods in help text.Elliott Hughes
2017-05-07Error if we can't autodetect filesystem type.Rob Landley
2017-02-20Declaring todo bankruptcy, dmesg goes back into pending until I get a chanceRob Landley
to unify the two codepaths in Elliott's rewrite.
2017-02-20Fix dmesg -c and -C.Elliott Hughes
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...)
2017-01-30Cleanup leftover debris.Rob Landley
2017-01-29Izabera suggested seq should multiply to avoid accumulating rounding errorsRob Landley
from incrementing by a double.
2016-12-11First cleanup pass on new dmesg.Rob Landley
2016-10-30Implement "dmesg -w".Elliott Hughes
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.
2016-07-15Fix non-library md5sum build. (Oops.)Rob Landley
2016-07-15Add optional openssl accelerated versions of hash functions, loosely based onRob Landley
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.
2016-07-14Add -c to md5sum and sha1sum.Rob Landley
2016-05-04Hostname cleanup, as described on the list.Rob Landley
2016-05-03Add -b and -F arguments to hostnamePaul Barker
These arguments are required to correctly set the hostname at boot time. They are used by the '/etc/init.d/hostname.sh' init script in an OpenEmbedded system.
2016-03-02For years the man pages have said to #include <sys/types.h> to getRob Landley
major/minor/makedev, but glibc has vowed to break existing programs (https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html) and replace it with _another_ non-standard header (not in posix or lsb), so let's just add functions to lib/ that do the transform ourselves.