aboutsummaryrefslogtreecommitdiff
path: root/toys
AgeCommit message (Collapse)Author
2020-04-20patch: fix out of bounds memory access.Elliott Hughes
On empty lines, we'd read one byte before the start of the buffer.
2020-04-16cpio: fix tests by removing --trailer.Elliott Hughes
f2866cf58a07c9d681ecd6695ea969ac70e59a3d fixed the cpio --trailer check as it claimed to, but doing so changed our behavior (since it used to be always-on and is now off unless you supply --trailer). This broke one of the cpio tests. Since I can't find any other cpio that has a --trailer option (or its inverse), this patch removes --trailer. This reverts our behavior to our old behavior (always include the trailer). Judging by the fact that the cpio tests pass with TEST_HOST=1, this seems to be the expected behavior.
2020-04-16Promote rtcwake.Rob Landley
2020-04-16Minor cleanup.Rob Landley
2020-04-16Promote blkdiscard.Rob Landley
2020-04-16Cleanup blkdiscard.Rob Landley
2020-04-16Weed-whack a few warnings out of pending so allyesconfig is less noisy.Rob Landley
2020-04-15fdisk: change sector_t to unsigned long long to fix -WformatEthan Sommer
2020-04-15ip: appease clang warningsEthan Sommer
fix false positive -Wformat-security by passing string literal directly to error_exit, instead of assigning it to a variable and passing that fix -Wparentheses-equality by removing extra parentheses
2020-04-15groupadd: fix -Wformat and switch to FLAG() macrosEthan Sommer
2020-04-15Based on a patch from Ethan Sommer: silence warning and convert to FLAG()Rob Landley
2020-04-15cpio: fix --trailer flag check, switch to FLAG() macros.Ethan Sommer
2020-04-14shred: fix -z flag check, switch to FLAG() macros.Ethan Sommer
2020-04-14Implement $''Rob Landley
2020-04-14Start of $- and set flags support.Rob Landley
2020-04-13Humor asan.Rob Landley
(ls would read from an uninitalized variable and never use the result because the test is afterwards, but asan freaks about impurity and unclean quantum state that's never observed or some such. You read uninitialized but definitely allocated stack memory into a REGISTER, and then performed an ADDITION on it to produce a result you never use! For SHAME!)
2020-04-13Add unescape2(), migrate some unescape() users over.Rob Landley
2020-04-12Minor cleanup.Rob Landley
2020-04-12Fix sh -c 'CONSOLE="$(</sys"' segfault (don't advance twice after quote).Rob Landley
2020-04-12Add shift and $[], fix exec.Rob Landley
2020-04-09blkdiscard: new commandPatrick Oppenlander
2020-04-09Fix "else" loop.Rob Landley
2020-04-08Implement ! and $$ and fix quoted "$(subshell)"Rob Landley
2020-04-08md5sum: don't initialize a table we don't use.Elliott Hughes
If you configure toybox with libcrypto, you don't need toybox to initialize its own table statically _or_ dynamically.
2020-04-08ls: fix -h with block counts.Elliott Hughes
The filter() function modifies st_blocks so it's always 1KiB rather than 512B blocks, but the human-readable output was still assuming 512B. This meant that `ls -sh` was showing figures half the size of `ls -s`, and that the "total" line with -h was also off by a factor of 2. No new test, because I don't know how to write one that would work on all file systems. Bug: http://b/153383721
2020-04-07Minor cleanup.Rob Landley
2020-04-07Calculate table when float enabled, and rely on LP64 types.Rob Landley
2020-04-07Use optc to detect end of arguments, because [ removes ] but doesn't zero it.Rob Landley
2020-04-06Pass more tests, and detect ELF files (don't try to run them as shell scripts).Rob Landley
Don't fall back to stdin if we can't find shell script on command line.
2020-04-04Fix lifetime rules in bracket expansion.Rob Landley
2020-04-02Move #include <linux/*.h> into individual commands, initialize structRob Landley
with memset() instead of = {}, and move TT.alarm to local variable.
2020-04-02Fix macOS build.Elliott Hughes
I'd put the rtc_wkalarm struct in the globals to get it zeroed for free, but since there's no such type on macOS, that breaks the build. Rather than define a bogus struct in portability.h, I've gone for making it an explicitly-zeroed local. (And I've sorted the locals largest-first.) Note that the use of struct rtc_time as if it was the same as struct tm in this code follows the existing code in hwclock, but I worry that we're going to have trouble with that because of the extra tm_gmtoff and tm_zone fields in struct tm. But that's a worry for another day... This patch also removes the CONFIG_CP_PRESERVE from the macos_miniconfig, since that option was removed a while back.
2020-04-02More shell plumbing. Redo of variable storage, add export.Rob Landley
2020-04-01Add rtcwake.Elliott Hughes
Some of the bringup folks are debugging RTC issues and asked for this. Rather than duplicate the weird xtzset dance with mktime, I've factored that out into a new xmktime that takes a boolean for whether to use UTC or local time. Otherwise, the slight cleanup of hwclock.c is entirely optional. The only functional change there is that util-linux 2.34's hwclock uses ISO time format, which is the usual toybox preference anyway, so I've switched it over to that rather than ctime(3). Bug: http://b/152042947
2020-03-29file: add 7z formatJoeky
2020-03-29ping: print ttlanatasluo
2020-03-28sed s///: support POSIX I as synonym for iElliott Hughes
POSIX chose I rather than i as the case-insensitive flag for s///, because apparently more seds support I than i. We're allegedly alone in only supporting i. (On the Mac, sed supports neither.) Strictly this isn't *currently* in POSIX, but it's been accepted for issue 8. Bug: https://austingroupbugs.net/view.php?id=779#c2050
2020-03-26du: consistent --help capitalization.Elliott Hughes
2020-03-26du: Implement -bRob Landley
2020-03-23tar: implement --absolute-names.Elliott Hughes
Used by the Linux kernel build when copying kernel headers to kernel-headers.tar.gz. Bug: http://b/152244851
2020-03-18Next round of shell work.Rob Landley
Rethink syntax_err a bit. Try to track top level shell pid for $$ including passing it to nommu subshells. Reset hfd more often so it doesn't climb endlessly. Leak fewer filehandles and detect more filehandle exhaustion errors. Replace skip_quote() with a second mode for parse_word(). Fix $() and implement $(<input).
2020-03-18Fix WARN_ONLY (and the one caller feeding it in the field it was checking).Rob Landley
2020-03-16vi: implement H/M/L.Elliott Hughes
Turns out I move around using these a lot too. I do tend to have very tall terminals...
2020-03-16vi: semi-functional ^E/^U and ^F/^B.Elliott Hughes
The forward movement seems okay (no worse than the equivalent arrow key movement), but I haven't yet worked out how to move the cursor back when necessary. Also fix the location of the cursor in ex mode, and stop showing ex commands in bold.
2020-03-13Pass a few more test suite entries.Rob Landley
2020-03-13Fix "eval x=y", add exec, only prompt if stdin is a tty, search $PATH for scriptRob Landley
2020-03-13Fix various typos.Elliott Hughes
In case I'm not yet in the running for the most pedantic change of this release, I think the "days of the week are written with initial capitals in English" subset of this patch is a strong contender. (Found via `toybox help -a | ispell -l | sort | uniq`.)
2020-03-13readelf: fix interpreter name length check.Elliott Hughes
Looks like I left off half way through this! Also default readelf to n while it's still in pending.
2020-03-12Shuffle code around: eliminate one of two function prototypes, add "static"Rob Landley
to functions that aren't entry points, and collate debug code at top.
2020-03-11Redo NOFORK plumbing so commands like eval/unset can access/edit shell state.Rob Landley