aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-10-25ash: add comment explaining "set -e; $(cmd)" discrepancyDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-25ash: reduce code differences from upstreamDenys Vlasenko
Upstream commit: Date: Wed, 8 Sep 2010 16:21:52 +0800 [JOBS] Debug compile fix No point in tracing a no longer undeclared "ps->cmd", fixes: jobs.c: In function \u2018commandtext\u2019: jobs.c:1192: error: \u2018ps\u2019 undeclared (first use in this function) jobs.c:1192: error: (Each undeclared identifier is reported only once jobs.c:1192: error: for each function it appears in.) Signed-off-by: maximilian attems <max@stro.at> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-25ash: remove unused EXSHELLPROCDenys Vlasenko
Upstream commit: Date: Sun, 28 Nov 2010 20:47:07 +0800 [BUILTIN] Stop documenting EXSHELLPROC At some point between ash 0.3.5-11.0.1 and ash 0.3.8-37, Debian ash stopped using the EXSHELLPROC exception to handle shell scripts without a magic number. Remove all remaining references to it to avoid confusion. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-25ash: [BUILTIN] Use EXEXIT in place of EXEXECDenys Vlasenko
Upstream commit: Date: Sun, 28 Nov 2010 20:44:37 +0800 [BUILTIN] Use EXEXIT in place of EXEXEC The intended semantics of EXEXEC are identical to EXEXIT, so simplify by using EXEXIT directly. Functional change: in edge cases (exec within a trap handler), this causes the exit status from exec not to be clobbered. For example, without this patch: $ sh -c 'trap "exec nonexistent" EXIT'; echo $? exec: 1: nonexistent: not found 0 And with it: $ sh -c 'trap "exec nonexistent" EXIT'; echo $? exec: 1: nonexistent: not found 127 Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-25ash,hush: set exit code 127 in "sh /does/not/exist" caseDenys Vlasenko
Upstream commit 1 for ash: [ERROR] Allow the originator of EXERROR to set the exit status Some errors have exit status values specified by POSIX and it is therefore desirable to be able to set the exit status at the EXERROR source rather than in main.c. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Upstream commit 2 for ash: [INPUT] Use exit status 127 when the script to run does not exist This commit makes dash exit with return code 127 instead of 2 if started as non-interactive shell with a non-existent command_file specified as argument (or a directory), as documented in http://www.opengroup.org/onlinepubs/009695399/utilities/sh.html#tag_04_128_14 The wrong exit code was reported by Clint Adams and Jari Aalto through http://bugs.debian.org/548743 http://bugs.debian.org/548687 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> NB: in fact, http://bugs.debian.org/548687 was not fixed by this: "sh /dir/" thinks that EISDIR error on read is EOF, and exits 0. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-25udhcpc: check read of overload option data byte to be within packetDenys Vlasenko
function old new delta udhcp_get_option 220 225 +5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-25udhcpc: check read of option length byte to be within packetBrian Foley
function old new delta udhcp_get_option 215 220 +5 udhcp_run_script 802 803 +1 Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-24strings: implement -t radixTito Ragusa
v2: minor code cleanup, no changes. v1: Implement -t radix option. Fix help text for -o option. Signed-off-by: Tito Ragusa <farmatito@tiscali.it> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-24ash: explain EXP_REDIR and why we (dont) glob redir filenamesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-24awk: fix segfault on for loop syntax errorBrian Foley
Parsing "for()" segfaults as awk fails to find loop iteration expressions. Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-24lineedit: fix completion with applet names. closes 9361Denys Vlasenko
Patch by Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-24ash: return exit status of nofork appletsRon Yorston
The commit 'ash: eval: Return status in eval functions' changed how exit status is handled in eval functions. The case of nofork applets was missed, resulting in the incorrect status potentially being returned for nofork applets when FEATURE_SH_NOFORK is enabled. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-14examples: update var_service/README againDenys Vlasenko
Added "ps -AH e" example Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-14typo fixes in docDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-14examples: update var_service/README againDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-14examples: update var_service/READMEDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-13telnetd: ifdef out a buggy error handling code pathDenys Vlasenko
Here, not handling the error is would just eat one input 0xff char. Correct handling would need even more corner case handling, as-is buggy handling corrupts the buffer. Since we just been told by kernel that pty is ready, EAGAIN should not be happening here anyway. function old new delta telnetd_main 1798 1785 -13 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-12cpio: fix restoration of file ownership, closes 9306Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-12telnet: code shrinkDenys Vlasenko
put_iac2(w,c) is mostly used with constants, fold them into one arg function old new delta put_iac2_merged - 46 +46 telnet_main 1603 1583 -20 con_escape 285 257 -28 put_iac2 50 - -50 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 0/2 up/down: 46/-98) Total: -52 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-12telnetd: add another handshake example in comments, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-12telnetd: treat all 2-byte IACs in 240..249 range as NOPs.Denys Vlasenko
A bit of future-proofing. Some of them can stand just being ignored. function old new delta telnetd_main 1791 1798 +7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-12telnetd: fix corner case of input processing of 0xff bytesDenys Vlasenko
I managed to reproduce the bug, with some difficulty. function old new delta telnetd_main 1780 1791 +11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-12telnetd: fix a corner case where CRLF->CR translation can misbehaveDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-12telnetd: fix handling of short writes to ptyDenys Vlasenko
If a write to pty is short, remove_iacs() can be run on a buffer repeatedly. This, for example, can eat 0xff chars (IACs, in telnet terms). Rework the logic to handle IACs in a special "write to pty" function. function old new delta telnetd_main 1662 1750 +88 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-11more: accept and ignore a bunch of optionsDenys Vlasenko
Alpine Linux stumbled over "more -s": http://bugs.alpinelinux.org/issues/5190 function old new delta more_main 857 872 +15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-09ifupdown: rewrite state file atomicallyDenys Vlasenko
By user's request. Decided to not use fcntl(F_SETLKW) in lieu of problems with locking on networked filesystems. The existence of /var/run/ifstate.new is treated as a write lock. rename() provides atomicity. function old new delta ifupdown_main 1019 1122 +103 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-07tcpsvd: don't keep shared fd open if fd limit is reached. closes 9331Denys Vlasenko
Also, much improved help text. function old new delta packed_usage 30652 30851 +199 tcpudpsvd_main 1782 1784 +2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-07ash: all blocks in function node copying must be SHELL_ALIGNedDenys Vlasenko
Previous commit probably introduced a bug: non-matching size calculation in size counting and actual copying caused by SHELL_ALIGN being applied differently! This won't bite if string sizes are also SHELL_ALIGNed. Thus fixing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-07ash testsuite: fix false positivesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-07ash: get rid of two global data variablesDenys Vlasenko
function old new delta calcsize 126 147 +21 funcstring_end - 4 +4 sizenodelist 28 24 -4 funcstringsize 4 - -4 funcstring 4 - -4 funcblocksize 4 - -4 nodeckstrdup 48 39 -9 evaltree 828 788 -40 ------------------------------------------------------------------------------ (add/remove: 1/3 grow/shrink: 1/4 up/down: 25/-105) Total: -40 bytes text data bss dec hex filename 943376 916 14292 958584 ea078 busybox_old 943344 916 14284 958544 ea050 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-07ash: comment out free(p) just before _exit, tweak some outdated commentsDenys Vlasenko
Planned to sync exitshell up to dash, turned out ours is better :) Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-04wget: there is no -s option in GNU Wget 1.18, we should be compatibleDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-04dhcp: merge leases.c and static_leases.c into dhcpd.cDenys Vlasenko
function old new delta send_offer 292 461 +169 udhcpd_main 1531 1588 +57 read_leases 330 332 +2 add_lease 314 312 -2 find_lease_by_mac 68 - -68 find_free_or_expired_nip 174 - -174 ------------------------------------------------------------------------------ (add/remove: 0/4 grow/shrink: 3/1 up/down: 228/-244) Total: -16 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-04dhcp: merge most of static_leases.c into dhcpd.cDenys Vlasenko
function old new delta read_staticlease 121 222 +101 add_static_lease 48 - -48 log_static_leases 68 - -68 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 1/0 up/down: 101/-116) Total: -15 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-04dhcp: merge files.c into dhcpd.cDenys Vlasenko
Added NOINLINE to two function, since my version of gcc would actualy increase code size otherwise. I see no size changes. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-03examples: add example of a DHCP serverDenys Vlasenko
As usual, by multiplying directories - "dhcpd_eth0", "dhcpd_wlan1" you can run many servers on different interfaces. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-03hush: add commented-out debug printouts in "memleak" built-inDenys Vlasenko
Allocation addresses of malloc() are jittery, thought I had a mem leak in hush, but it was malloc variability. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-03hush: fix a memory corruption when exported variable is modifiedDenys Vlasenko
The construct such as this: t=1 export t t=new_value1 had a small probability of momentarily using free()d value. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-03hush: fix exitcode on exec failure with EACCES - should be 126Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-03sh testsuite: add tests for exitcode on failure to execDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-03shell: delete all msh testsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-03hush testsuite: fix another false positiveDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-03hust testsuite: fix a false positiveDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-03ash testsuite: add most of hust tests which pass for ashDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-02ash: [PARSER] Add nlprompt/nlnoprompt helpersDenys Vlasenko
Upstream commit: Date: Mon, 29 Sep 2014 22:53:53 +0800 [PARSER] Add nlprompt/nlnoprompt helpers This patch adds the nlprompt/nlnoprompt helpers to isolate code dealing with newlines and prompting. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-02whitespace fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-02hush: add var4.tests, var5.testsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-02hush: fix var3.testsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-02sh: do not print empty line at the end of "help" outputDenys Vlasenko
It's pointless. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-02sh testsuite: sync ash-redir/ and hush-redir/Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>