aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-03-26Create (lsb) chsh commandMichael Christensen
2021-03-24Fix install -tEthan Sommer
2021-03-20Nir Lichtman pointed out that rm -p shouldn't try to rmdir / at the end.Rob Landley
2021-03-19Fix another sh regression.Rob Landley
2021-03-19Fix some more sh regressions.Rob Landley
2021-03-18Fix first few testsuite regressions from function/local plumbing.Rob Landley
2021-03-18telnetd: don't exit if waitpid() returns 0.Elliott Hughes
Noticed while using telnetd to manually test some telnet fixes: telnetd would sometimes exit when I'd disconnect because it couldn't find pid 0 on its list of sessions. I've not seen obscure exits because select() times out, but I've also changed that `return` to an error_exit() so we'll at least know what's happened if that ever occurs. Also use <arpa/telnet.h> rather than manually #define'ing its constants, use the FLAG() macro throughout, and xsetsockopt(). Don't pointlessly set errno to 0 at the start of main and then never look at it again.
2021-03-17init: fix waitforpid().Elliott Hughes
The kill(2) should be checking whether `pid` still exists, not the process that wait(2) just told us has exited.
2021-03-17Tighten up parse_word() a bit and and teach it to read empty ${}Rob Landley
(fixes up some test suite tests).
2021-03-17vi: various fixes.Elliott Hughes
I've been using toybox vi as a makeshift "less" lately. This patch contains all the fixes I've made... $ should go to the last character before the newline, not the newline. Fix ^b and ^f, and ^e and ^y (which was mistakenly ^u before, which is also a movement key, but half of ^d/^u, neither of which we actually implement, and neither of which I've ever used myself --- I might have large hands, but they're not _that_ large). Fix the display of lines longer than 1024 characters. Fix the display of the "~"s after the end of the file, and use VT100 dim to make it a bit more obvious that they're not actually part of the file. Also be a bit more consistent about \033 which is the most common way to write \x1b in toybox. Don't show the status while in ex mode. Make what the status is showing a little less unclear by adding a "C" for the byte offset and file size, and add a percentage (albeit one based on bytes rather than lines). Fix the flickering seen on updates with the usual stupid trick of setting a large buffer. Handle SIGWINCH. Add support for Home/End/PageUp/PageDown. Remove a bit of duplication around calls to draw_page().
2021-03-17Add local variables and basic function() support plumbing.Rob Landley
Not fully wired up yet, probably a bunch of regressions.
2021-03-16Add more shell tests, and teach txpect to do regex matches (RO and RE).Rob Landley
2021-03-15chmod: fix +X.Elliott Hughes
I broke this when I added the masking out of the S_IFMT bits for macOS, because string_to_mode needs the full mode with those extra bits, specifically so that it can recognize directories for +X to work. I've duplicated chtest rather than change chtest to explicitly set the modes to 000 before running the given chmod command because I didn't want to touch *all* the tests and obscure the addition of just one.
2021-03-13Commit 3b9cfa70db needed some cleanup I forgot to do, oops. Elliott stumbledRob Landley
across one of the issues I forgot to fix. Added a couple comments and renamed a variable to try to clarify the code while I was there.
2021-03-13Elliott spotted that errno==EAGAIN usually goes with an rc of -1, not 0.Rob Landley
(I hit 0 paired with EAGAIN causing premature pipeline end many years ago when a pipeline was Ctrl-Z then fg, may not still be possible with modern kernels but I left that covered just in case.)
2021-03-12Fix grep bug testing errno before check statusRobin Hsu
It's legal for a system call to set non-zero errno and return a good status. The caller (grep) should check return status first. Test: 2000 loops of greping 1000+ lines each loop Signed-off-by: Robin Hsu <robinhsu@google.com> Change-Id: I55f7cd5d8a6289c5e8a21ed3057e995a75b9b4fa
2021-03-12df: Allow -P + -k together as defined in POSIXDaniel Santana
2021-03-09Minor tweaks: #define -> inlineable function, while() -> for(;;)Rob Landley
2021-03-09tar: fix base-256 output.Elliott Hughes
A tar file created by toybox tar with values large enough to need base-256 rather than ASCII octal caused a tar reader to crash, and caused GNU tar to complain. I note from the docs at https://github.com/libarchive/libarchive/blob/master/libarchive/tar.5#L326 that they imply that only the top *bit* should be set to indicate this format, not the whole top byte, to give a 95-bit or 63-bit field. But I don't think we can hit that in practice? Bug: http://issuetracker.google.com/181683612
2021-03-05Some more shell tests.Rob Landley
2021-03-01Yi-yo Chiang wants cpio -u implemented, and sent some tests.Rob Landley
2021-02-28Tar should remove empty directories where it wants to put a non-directory.Rob Landley
2021-02-23dd: simplify signal handling and fix status output.Elliott Hughes
Other dd implementations always show the status on exit, whether success or failure. Fix that by using xsigatexit() (and clarify the comment for that function a little, since it didn't previously address the "at exit" part of its behavior at all). This also fixes SIGUSR1 behavior so that we show the status immediately rather than on the next trip round the read/write loop. Tested with `dd of=/dev/full`, sending SIGUSR1 twice from another shell (to see the status immediately each time, without exiting), then hitting ^C (to see the status and then exiting), then restarting dd and hitting enter (to see a write error followed by the status before exiting). Bug: https://issuetracker.google.com/177017283
2021-02-23Add df to the macOS default configuration.Elliott Hughes
"Works for me".
2021-02-22Remove ifdefs from stat.Rob Landley
2021-02-22stat: fix macOS build and behavior.Elliott Hughes
My patch to fix df behavior on macOS broke the stat build on macOS. First off, we had %s and %S the wrong way round compared to coreutils, though since Linux always seems to use the same value for both, no-one will ever have noticed. Annoyingly, Linux and macOS disagree about what statfs::f_bsize means, and whether statfs::f_iosize and statfs::f_frsize exist (each has one or the other, depending on what f_bsize *doesn't* mean to them). This mess is presumably why statvfs exists. Unfortunately, statvfs on macOS at least doesn't contain the file system type information. So we either need to do *both* statfs() and statvfs() for macOS, or we need to take into account the different fields. This patch adds an #ifdef outside of portability.h because I wasn't sure we actually wanted to add statfs_best_transfer_size() and statfs_real_block_size() functions to lib for this. But that's an easy cleanup if desired.
2021-02-22Nope, marshalling install -D to cp caused regressions.Rob Landley
2021-02-21Teach -o to print ranges that produce zero length matches.Rob Landley
And fix one test for NUL that should be a length test for -z support
2021-02-20Fix df on macOS.Elliott Hughes
On Linux, struct statvfs' f_bsize and f_frsize seem to be interchangeable. On macOS, they're wildly different. f_bsize is the "preferred length of I/O requests for files on this file system" (corresponding to statfs::f_iosize), and f_frsize is the "size in bytes of the minimum unit of allocation on this file system" (corresponding to statfs::f_bsize. POSIX appears to say nothing about the interpretation of these fields, but man7.org's statvfs(2) page is quite clear that statvfs::f_blocks, for example, is in units of f_frsize, not f_bsize. This is the only place in the tree where we use statvfs::f_bsize (other than the stat(1) output that's supposed to be f_bsize and that has a corresponding f_frsize dual anyway. I've removed the Apple-specific #define f_frsize in portability.h because that seems to have been from my previous attempt to understand what was going on here. The output of the relevant stat(1) fields on macOS are the same before/after this patch. This makes toybox df's output match the system's df on a MacBook Pro running macOS 11.2.1. Tested on a Raspberry Pi 400 running Linux too, where I see no change in the output before/after this patch.
2021-02-19Ethan Sommer pointed out that install -Dt needs -D marshalled to cp.Rob Landley
2021-02-19Fix cp -t with one argument and make --parents work with -t.Rob Landley
2021-02-17Teach df /dev/node to reliably show rdev even when devtmpfs is mountedRob Landley
more recently than the resulting mount point.
2021-02-16Only error once for each "df nonexistent"Rob Landley
2021-02-16Let df -a show overmounted filesystems.Rob Landley
2021-02-15Fix mount.test command string quotingYo Chiang
Use "" instead of '' to quote command as the command contains expandable variables. Change-Id: Iaa8825e56243b369199588cbf6e47a1aba985804
2021-02-14Redo df plumbing a bit.Rob Landley
2021-02-14cpio: Guard free() with CFG_TOYBOX_FREEYi-Yo Chiang
2021-02-14Add find -executableRob Landley
Requested by aheirman on github: uses access(X_OK) which checks access control lists as well as permissions, and that _we_ can access them (u+x could be owned by a different user)...
2021-02-14Cleanup pass on df.Rob Landley
2021-02-13Minor cleanup.Rob Landley
2021-02-11Add -t to cp and mv.Rob Landley
2021-02-11Switch sha3sum on in defconfig, and document -b (it's same as sha2sum).Rob Landley
2021-02-10Add install -tRob Landley
2021-02-09ulimit: include descriptions and units.Elliott Hughes
Also reorder the --help output to separate the "whats" from the "hows", as with other commands that have lots of options, and add units to the help too.
2021-02-08Yi-Yo Chiang reported that readlink() failures could corrupt archiveRob Landley
by not writing as much payload as the header promised.
2021-02-08Have xclose() perform the fd != -1 test.Rob Landley
2021-02-08Yi-Yo Chiang pointed out install -D was broken when the target file exists.Rob Landley
Add a test, with comment that "make install_test" doesn't currently exist...
2021-02-07Remove unused function.Rob Landley
Ethan Sommer noticed that chown is using chgrp_main() due to OLDTOY, so the wrapper function isn't needed.
2021-02-07Add lots of "static" annotations, make a couple things use FLAG() macros, etc.Rob Landley
2021-02-06netcat.test: reduce flake.Elliott Hughes
Starting two netcats at the same time and expecting them to be able to talk to each is a little optimistic. I don't know whether `sleep .1` will be sufficient, but wanted to try that before going to `sleep 1` since neither the toybox nor the github nor the Android infrastructure is running these tests in parallel, those seconds add up. Right now this has a ~20% flake rate on the Android infrastructure. I was able to reproduce the flake locally with `while true ; do make test_netcat ; done` on my desktop before this patch, but not after. (Though my desktop is way overpowered for just running that, whereas the build servers tend to be pretty busy, which is why I reserve the right to return later with a longer delay.)