aboutsummaryrefslogtreecommitdiff
path: root/toys/pending
AgeCommit message (Collapse)Author
2021-04-28Toysh don't free function arguments before function returns.Rob Landley
2021-04-27Make toysh function return properly and run next statement.Rob Landley
2021-04-27Make toysh actually run a shell function.Rob Landley
2021-04-27Don't send reverse DNS lookups out into the world for something that'sRob Landley
mostly only safe to use behind a firewall or through a VPN these days.
2021-04-26More toysh function work.Rob Landley
Of course "x() { echo hello; } | tr e f; x" allows the pipe but not the call. Ok, take out the union so you can && after a function declaration.
2021-04-25First pass at toysh function() definition plumbing.Rob Landley
2021-04-24telnet: various fixes.Elliott Hughes
This got a bit out of hand. All I wanted to fix was the CR conversion to get this part of https://tools.ietf.org/html/rfc854 right: Therefore, the sequence "CR LF" must be treated as a single "new line" character and used whenever their combined action is intended; the sequence "CR NUL" must be used where a carriage return alone is actually desired; and the CR character must be avoided in other contexts. This rule gives assurance to systems which must decide whether to perform a "new line" function or a multiple-backspace that the TELNET stream contains a character following a CR that will allow a rational decision. But to understand the code well enough to do that, and to fix it so that it works when IAC or CR sequences are split across multiple reads, I ended up rewriting a lot: * Add punctuation in help. * Remove duplicated #include. * Remove some unnecessary globals, enlarge the global buffers, and keep state for correct IAC sequence processing across reads. * Reduce code duplication and rewrite bits that made no sense. * Handle entering/exiting raw mode more uniformly. * Fix the prompt (the character count was wrong). * Allow ^]^D (like BSD telnet) as well as ^]e to exit, and look less like we crashed when doing so. * Simplify the IAC sequence handling, but more importantly work correctly when a sequence is split across multiple reads. * Use more of the existing "x" functions from lib. (And remove code that was duplicating what the "x" functions they'd just called had already done.) * Show "Connected to". * Better signal handling. I'm still not happy with TELOPT_ECHO and TELOPT_SGA in handle_wwdd(), but don't (yet) understand them well enough to simplify them further. On the bright side, I think TELOPT_NAWS is a lot clearer now. It also occurs to me now I'm looking at the diff that although the IAC output code is now better than it was, it probably still isn't pulling its weight and might better be replaced by printf(). ...but this patch has already gotten way out of hand!
2021-04-24telnetd: handle TIME_WAIT better.Elliott Hughes
After a network outage, a long-running telnetd was spinning trying to read from a socket that was in TIME_WAIT. It's easy to reproduce this by using the regular telnet client and typing ^]^D to exit abruptly. I don't think these sockets should ever have been non-blocking, and we want to give up on the client if we hit EOF. All of this needs rewriting to be less complicated (and not use select(2)), but this seems to be a minimal fix for the spin without harming normal usage (where by "usage" I mean "testing the telnet client").
2021-04-24telnetd: pass `-h hostname` to login(1).Elliott Hughes
Handling utmp is login's job: telnetd should just pass the appropriate option to login. (I was investigating a different bug that caused telnetd to take 100% CPU after a network outage and noticed an unexpected utmp fd. It turned out to not be relevant to my actual problem, but it did remind me that this utmp code isn't right in small details like that, but also in the bigger picture: it's writing the wrong information, and only on logout, not login. But rather than try to fix it, let's just let login do its job.)
2021-04-14Fix $IFS: skip trailing whitespace after first non-whitespace separator.Rob Landley
2021-04-12readelf: Display properly in 80 columns, don't reject .bss off end of file.Rob Landley
2021-04-11toysh: save _resolved_ variable contents in $IFS cache.Rob Landley
2021-04-10Fix more toysh tests.Rob Landley
2021-04-10Fix next couple of sh tests.Rob Landley
Cached $IFS value has to be per function context because local vars.
2021-04-03Fix the next test.Rob Landley
2021-04-03Add a missing pop_block().Rob Landley
2021-03-31Toysh: adding function logic screwed up pipe/block logic. Fix it.Rob Landley
Remove cached blk/pout/urd and make TT.ff->blk always be populated instead (like TT.ff, list is never empty), have current pipe (and block trailing) redirections live in current TT.ff->blk. Left in a bunch of commented debug printfs and a filehandle dump function.
2021-03-29Fix system calls and get rid of tempfileMichael Christensen
2021-03-27More cleanup of chsh.cRob Landley
2021-03-27chsh cleanup: Reindent and tweak help text.Rob Landley
2021-03-26Create (lsb) chsh commandMichael Christensen
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-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-03Cleanup pass on modprobe.Rob Landley
I need to set up a test environment for this...
2021-01-30Fix a couple of test regressions from last commit adding function() plumbing.Rob Landley
2021-01-28toysh: start of function call logic.Rob Landley
2021-01-28Shut gcc's "is not actually used uninitialized" false positive warnings up.Rob Landley
2021-01-26A few more getty cleanups.Rob Landley
2021-01-26getty/telnet/tftpd: minor cleanup.Elliott Hughes
Remove STDIN_FILENO and use FLAG(). Use xsetspeed() rather than have a duplicate table. Inline getty's print_prompt(). There's still a lot of cleanup needed here, in particular use of toybuf and removal of the inappropriately-named HOSTNAME_SIZE (and ideally sharing that logic with login(1) which already contains a better implementation of it).
2020-12-26toysh: fix break/continueRob Landley
2020-12-25toysh fixes and testsRob Landley
2020-12-19Fix (( )) quote termination.Rob Landley
2020-12-15Implement set, trace support, and function call context stack.Rob Landley
2020-12-07Promote pwgen.Rob Landley
2020-12-07Cleanup pwgen as described on the list.Rob Landley
http://lists.landley.net/pipermail/toybox-landley.net/2020-December/012169.html
2020-12-06unicode: new toy.Elliott Hughes
Based loosely on the Plan9/Inferno utility, and a convenient way to go back and forth between code points and utf8 sequences. This patch also fixes a couple of bugs in wctoutf8 (and the tests for this toy effectively serve as unit tests for wctoutf8/utf8towc).
2020-12-05new toy: Add pwgenMoritz Röhrich
Add new toy `pwgen`. A usefule password generation utility.
2020-12-05tr: fix pathological flushing.Elliott Hughes
The AOSP build doesn't use tr (or anything that's still in pending), but the kernel folks have been more aggressive. They found that tr's pathological flushing was adding minutes to their build times. Just removing the fflush() made tr significantly faster for my trivial test, but still slow, with all the time going into stdio. Rewriting the loop to modify toybuf in place and then do one write per read made most of the difference, but special-casing the "neither -d nor -s" case made a measurable difference too on a Xeon. Bug: http://b/174773617
2020-11-27toysh: Adjust $0 for scripts.Rob Landley
2020-11-16Factor out do_source(), fpathopen(), and prompt_getline().Rob Landley
Use 0 optstr prefix, fix bug initializing toys.envc one too low.
2020-11-12readelf: harden against invalid input.Elliott Hughes
I also promised to fix readelf. Where in file(1) I made no attempt to say what was bad (or even to change `goto bad` to explicitly say that *anything* was bad), I believe that readelf is much more likely to be shown invalid ELF files, and that it would be useful to have some clue as to what's wrong. Relatedly, this patch removes all existing error_exit() calls in case it's being used on multiple files. Again, this survived ~24hrs of AFL++ trying to blow its house down. Test: ~/AFLplusplus/afl-fuzz -i tests/files/elf -o fuzz-out -- ./readelf -a @@
2020-10-23Fix endless recursion bug on nommu for sh -c 'echo $(echo)'Rob Landley
2020-10-21Promote watchdog.Rob Landley