aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-04-07Don't let NOFORK arguments run through the multiplexer.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-06Integrate cross compile support into mkroot, ala "make root CROSS=sh4"Rob Landley
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 test fileJoeky
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-15gcc 8.3.0 changed its arm floating point syntax, plus error handling tweaks.Rob Landley
2020-03-13Pass a few more test suite entries.Rob Landley
2020-03-13More sh tests.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-12Fix get_block_device_size() for linuxGreg Kaiser
We were incorrectly passing a pointer to a pointer of an unsigned long long, when we just wanted to pass a pointer to the unsigned long long. This is especially bad on 32-bit systems, where we're then writing a 64-bits into a 32-bit value within ioctl. We fix this to pass a pointer to the unsigned long long. Test: On 32-bit device, no longer see native crash from toybox Bug: http://b/151311535 Signed-off-by: Elliott Hughes <enh@google.com>
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
2020-03-11fdlength: device size is reported in bytes, not blocks.Elliott Hughes
The shift was a remnant from when BLKGETSIZE (which measures in blocks) was being used on Linux. The Mac has two separate ioctls for block count and block size, which we're already multiplying together. And on Linux we're using BLKGETSIZE64, which returns a result in bytes, not blocks. So lose the shift.
2020-03-11vi: don't keep fd open unnecessarily.Elliott Hughes
As soon as mmap() is done, we can close the fd. xmmap() also will exit rather than return failure so we can remove that check, and fdlength() will fall back to lseek() so there's no need to have the fallback in vi itself. Spotted because the `TT.fd = 0` in linelist_unload() seemed suspicious; -1 would have been more natural.
2020-03-11Fix Mac build.Elliott Hughes
The recent re-enablement of the BLKGETSIZE64 code broke the Mac build. Use the equivalent <sys/disk.h> ioctl() pair instead.
2020-03-10modinfo: various fixes.Elliott Hughes
I came here because the new -Wno-unreachable-code-loop-increment warning didn't like the for loop on line 86. That loop is indeed not necessary. Use strend() to do a string suffix match. Use memmem() to search. It's available on macOS and Android by default, but it's behind _GNU_SOURCE for glibc, so add that to portability.h. Output the tags in the same order as the Debian modinfo. I've left "parmtype" in even though the Debian modinfo doesn't output it at all. Also fix the tests so that they work on a device that has modules for multiple kernels installed (like my laptop) --- make sure that the two modules we pick come from the same kernel.
2020-03-09Next round of shell plumbing: variable expansion with $IFS.Rob Landley
Not entirely debugged, but more or less there-ish.
2020-03-08cp: fix -D (--parents) (REWORK MINIMAL FIX)Jarno Mäkipää
add: test for -D fix: b/c/d/FILE not copying into a/ with -D option dirname() is not needed when handling FLAG(D) since filename under src or dest should not be changed. github.com/landley/toybox/issues/165
2020-03-06Yet more shell tests.Rob Landley
2020-03-05Fix 'for i in one two three; do echo =$i=; done'Rob Landley
2020-03-03Remove another command sub-option.Rob Landley
The question "how does this toybox command behave" should have an answer, not "it depends". (Also, --preserve at the start of a paragraph was confusing config2help.c into thinking it was an option paragraph.)
2020-03-02More cross.sh tweaks.Rob Landley
2020-03-02Move "scripts/cross.sh all" log files into root/log.Rob Landley
2020-03-02Check that cross compiler is there, not linker, before building native.Rob Landley
It builds binutils first, so ld being there doesn't mean cc finished.
2020-03-02Say command name before test result with txpect too.Rob Landley
2020-03-02Update the LP64 section.Rob Landley
2020-03-02Switch to FLAG() macros.Rob Landley
2020-03-02Merge realpath into readlink, use xabspath() instead of libc realpath().Rob Landley
2020-03-02Work around gcc trying to be "helpful" again.Rob Landley
2020-03-01Park Ju Hyung pointed out the fast path of fdlength() was commented out.Rob Landley
(Update to the 64 bit API while we're there. And yes, I checked in the kernel, it's 512 byte units.)
2020-03-01readelf: various fixes.Elliott Hughes
Add -e, and stop documenting no-op -W. Fix sign issues, and add a few extra sanity checks. Redo the BE/LE 16/32/64 reading. Remove the NOSPACE=1 from the -l test, and fix the -l code to match the binutils output. Most usefully, this fixes the weird way the NULL section's empty name would cause misalignment in the section to segment mapping output. Add a test for -s (symbol table).
2020-03-01Snapshot of variable resolution implementation. Not remotely load bearing yet.Rob Landley
2020-02-29Fix a couple of shell tests.Elliott Hughes
These didn't work on a system where readlink is a symlink to toybox, ironically.