aboutsummaryrefslogtreecommitdiff
path: root/toys
AgeCommit message (Collapse)Author
2020-09-12Replace HR_COMMAS with HR_NODOTRob Landley
The comma thing turned into an internationalization can of worms, don't go there. Keep the "show megabytes on systems with >10G" logic which includes not showing 0.0 for single digit values.
2020-09-10Add ipv6 support to wget.cChris Sarra
2020-09-10blkid: don't show empty tags.Elliott Hughes
The util-linux blkid (even if explicitly asked with -s) won't show you a tag with no value.
2020-09-09Use flag macros and document -rn options.Rob Landley
2020-09-09Use the infrastructure properly.Rob Landley
2020-09-09Cleanup of logger.c. (Asked for more testing on the list.)Rob Landley
2020-09-09Attempt internationalization of HR_COMMAS, 9 digit memory sizes for top,Rob Landley
and use the comma format when selected even if <3 digits (no 0.0M)
2020-09-08logger.c was failing to properly log local0-local6 facilities, due to a ↵Chris Sarra
string parsing error. This patch enables proper local facility handling.
2020-09-05Fix segfault for sh -c 'echo {a..Z}'Rob Landley
Bash produces different output for that test, but I'm not sure I care? http://lists.landley.net/pipermail/toybox-landley.net/2020-September/011990.html The problem is parse_word() guarantees its output's quotes/escapes are completed, but brace expansion happens after parse_word() and thus violating assumptions later code depends on to not do redundant error checking. The easy fix is to escape punctuation produced by parse_word (which in bash can only happen when you span upper and lower case ranges so "\" is the only interesting character). I could special case this to match bash exactly, but I'm waiting for someone to complain instead.
2020-09-04Autodetect pid length.Rob Landley
2020-09-04Add commas to top display, and adjust memory units to megabytes if >10G RAM.Rob Landley
2020-09-03Implement brace sequence expressions ala {a..z} and {1..37..2}Rob Landley
2020-09-02SIGHUP to init.c triggers inittab reloadChris Sarra via Toybox
2020-08-31Implement select.Rob Landley
2020-08-31Implement case/esac, add more wildcard tests.Rob Landley
2020-08-24tar: add -I (--use-compress-program) support.Elliott Hughes
This also changes the other compression options (such as -j) so that we pass no arguments for compression and just -d for decompression, which is what -I does to its filter and which appears sufficient. (I think I used -dc before just out of habit, since that's what I've been typing on the command line for decades.)
2020-08-24Cleanup watchdog.c, as described on the list.Rob Landley
2020-08-24Introducing toys/pending/watchdog.cChris Sarra via Toybox
This patch introduces a simple watchdog implementation for toybox. We send the appropriate ioctls to set the relevant timeouts, and intercept signals to safely shut down if required.
2020-08-23mv should only prompt for file being unwriteable when stdin is a tty.Rob Landley
2020-08-23Peter McConalogue pointed out that cp/mv -i prompt should default N.Rob Landley
Also, the failing mv test was because posix says to prompt when mv-ing over an unwriteable file only when stdin is a tty (but -i prompts either way)
2020-08-21Fix cp -P to not follow symlinks.Martin Stjernholm
Also fix help text to say that it is not the default.
2020-08-21Honor --no-preserve-owner for archive creation, and tidy up header comments.Rob Landley
2020-08-21cpio: fixes for Android kernel build.Elliott Hughes
Allow -pd to work by changing -p from an option that takes an argument to an option that implies there will be an argument (that is, `-pd x` is `-p -d x` with x being the directory for -p, rather than `-p d x` with d being the directory, as we previously interpreted it). Fix -d (aka --make-directories) to not be a no-op. Previously we acted as if this was always on. Accept --quiet and effectively just ignore it, since toybox cpio doesn't seem to produce any output that --quiet would suppress.
2020-08-19Cleanup symlink handling.Rob Landley
2020-08-19Patch out memory leak in tar.cChris Sarra
2020-08-18Add missing longopts alias for chgrp/chown and rmdirAntoni Villalonga
Heavily used long params under some contexts for already implemented options: chgrp/chown: Add alias '--no-dereference' for '-h' rmdir: Add alias '--parents' for '-p'
2020-08-14cleanup: use FLAG() macros, inline parse_arguments(), STDIN_FILENO is 0.Rob Landley
2020-08-12getty: ensure utmp is updated.Elliott Hughes
The key issues here turned out to be that getty is responsible for creating the file if it doesn't exist, and that the -H flag doesn't control whether utmp is updated, but whether or not to override the hostname within the utmp entry. While I'm here switch to the more modern utx APIs that all the non-pending parts of toybox use, and remove the duplication.
2020-08-11Fix spelling errorsAntoni Villalonga i Noceras
2020-08-05toysh: next round of wildcard plumbingRob Landley
2020-08-04xparsedate: support UTC offsets.Elliott Hughes
Requested in https://github.com/landley/toybox/issues/130, quoting an old version of the toybox help. This is also supported by coreutils. Set $LANG to C in the date tests so that they pass with TEST_HOST=1 (they were already failing for me, presumably related to a newer glibc).
2020-08-04xargs: fix help formatting.Elliott Hughes
2020-08-03Mark Salyzyn implemented support for xargs -P (run parallel jobs) because heRob Landley
has a build script that goes much faster with it, and added tests for it. I reimplemented it a different way, and did SIGUSR1 and SIGUSR2 support.
2020-07-30Don't need "match", just test *t.Rob Landley
2020-07-30find: support -type a,b,c.Elliott Hughes
Fixes #227.
2020-07-28toysh: more wildcard plumbingRob Landley
2020-07-22toysh: Start of wildcard plumbing.Rob Landley
2020-07-20patch fuzz: Always output original file's ' ' context lines, not from hunk.Rob Landley
2020-07-15toysh: NOSPLIT shouldn't collate whitespace $IFSRob Landley
2020-07-14toysh: honor nosplit, expand_one_arg shouldn't free (that's what del list for)Rob Landley
2020-07-12Fixing up failing tests cases.Rob Landley
2020-07-11Chunk of job control plumbing and start of ${x:1:3} variable slicing support.Rob Landley
2020-07-05wget: do not append toybox version at runtimeAriadne Conill
The sprintf() call, while technically valid (17 bytes fits in an 18 byte allocation) trips Alpine fortify-headers due to checking for allocations that could potentially overrun. The call is pointless anyway -- as we are appending a constant to another constant, it is better to just let the compiler do so and calculate the size. This is supported by ISO C89 and later, and thus any compiler that would be used to compile toybox. Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2020-07-05toys.h already includes poll.hRob Landley
2020-07-05dhcp6: use portable s6_addr instead of linux kernel-specific __in6_u.__u6_addr8Ariadne Conill
The glibc headers also provide that member, but s6_addr is the portable way. This fixes compilation on musl libc. Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2020-06-23William Djupström reported tar --exclude wasn't working. Fix and add test.Rob Landley
(Also fix -v output going to stderr when it shouldn't.)
2020-06-16file: add GIF version information.Elliott Hughes
This let me compare against the host for #225.
2020-06-16Ryan Prichard reported that file wasn't getting gif heights right.Rob Landley
2020-06-11hwclock: just assume /dev/rtc0.Elliott Hughes
(Apologies for the length of this commit message, but it's not entirely clear how we arrived at our present state, and right now all three of toybox, busybox, and util-linux differ from each other. And it took a week of arguments behind the scenes to agree on what we thought was the right behavior, which seemed worth capturing for posterity.) This reverts my change ef0546d4f536f42a57af4c32bd37f7fd752d10c2 from 2015. The commit message back then claimed: For systems using /dev/rtcN, /dev/rtc0 isn't necessarily the RTC that's used to provide the system time at boot time. We need to search for the RTC whose /sys/class/rtc/rtcN/hctosys contains "1". A few things to note here: 1. I can't find any historical motivation for this change. There's no bug, there's no internal email thread, and I can't even find anything referring to devices using anything other than /dev/rtc0. 2. It turns out (though this wasn't true at the time) that the kernel since 4.19 interprets hctosys as the RTC that *did* set the clock, not the RTC that *should* set the clock. 3. That's not an academic difference. If you have a cheap RTC that isn't battery-backed, or you have an RTC whose battery died, and you're using Linux 4.19 or later, you will boot with no RTC having hctosys=1. 4. An actual SoC vendor has hit this in practice. My original toybox patch appears to be equivalent to code in the Android frameworks, which -- under the auspices of the SoC vendor's bug -- I'm about to replace with code that checks "/dev/rtc" first, then "/dev/rtc0", then fails hard. (Strictly, it's this copy of the search that's causing the SoC vendor issues. AFAIK no-one's using hwclock/rtcwake except interactively. And even if they are, Android devices ship with [at least] two copies of toybox, so code/scripts on the vendor partition will continue to run the vendor copy of toybox they were developed against, and a newer toybox elsewhere on the system won't affect them.) All Android devices (and emulators) available to me at the moment use /dev/rtc0, but supporting /dev/rtc gives a workaround for anyone who really insists on using an RTC other than /dev/rtc0. That said, the Generic Kernel Image (GKI) always assumes /dev/rtc0, so going forward /dev/rtc0 is always the right choice. I did consider making toybox hwclock try /dev/rtc, /dev/rtc0, and /dev/misc/rtc -- and even wrote the code for that first -- but strace shows that busybox and util-linux's hwclock implementations differ in the order in which they try these (busybox tries /dev/rtc first, util-linux tries /dev/rtc0 first). Given that util-linux seems like the more canonical precedent, trying /dev/rtc0 and then falling back to /dev/rtc would offer no advantage to Android users (and would seem to be just another stumbling block in getting everyone to a world where /dev/rtc0 is "the" system RTC). Note that rtcwake is unaffected by all this, because the toybox and util-linux implementations both default to only trying /dev/rtc0 already. Bug: https://issuetracker.google.com/158051176
2020-06-10Chunk of job control pumbing.Rob Landley