aboutsummaryrefslogtreecommitdiff
path: root/shell (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ash: revert wrong "fix" for an apparent memory leak. Closes 5822Denys Vlasenko2013-01-171-0/+9
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* whitespace fixes. no code changesDenys Vlasenko2013-01-151-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* whitespace cleanup. no code changesDenys Vlasenko2013-01-143-6/+8
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: fix a memory leakJon Tollefson2012-11-131-0/+2
| | | | | | | | | | | | | | | The script which triggers the leak: while true do while true do break; done</dev/null done Signed-off-by: Jon Tollefson <kniht@linux.vnet.ibm.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: implement export -nDenys Vlasenko2012-10-011-4/+26
| | | | | | | function old new delta exportcmd 129 175 +46 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: trivial fixes for compile failuresDenys Vlasenko2012-09-251-5/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: fix "read -s" + ^C. Closes 5504Denys Vlasenko2012-09-062-1/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: declare strings with ALIGN1, as appropriateMichael Tokarev2012-07-241-1/+1
| | | | | Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: add a comment about VEXPORTDenys Vlasenko2012-07-071-0/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* include sys/resource.h where neededMike Frysinger2012-07-051-0/+1
| | | | | | | | We use functions from sys/resource.h in misc applets, but don't include the header. This breaks building with newer glibc versions, so add the include where needed. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* ash: fix a bug in >${varexp} handling. Closes 5282Denys Vlasenko2012-06-093-10/+26
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: remove sighandler_t definition hack, platform.h has it tooDenys Vlasenko2012-04-261-4/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* fix build breakage found by randconfigDenys Vlasenko2012-04-201-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: remove unused member struct command::is_stoppedDenys Vlasenko2012-03-271-4/+0
| | | | | | | | | function old new delta builtin_umask 133 132 -1 checkjobs 551 544 -7 builtin_fg_bg 291 267 -24 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cttyhack: handle multiple consoles found in sysfsAaro Koskinen2012-02-041-3/+10
| | | | | | | | | | | | If multiple consoles are found from the sysfs file, cttyhack fails: cttyhack: can't open '/dev/tty0 ttyS0': No such file or directory In such cases take the last one as the kernel will use that one for /dev/console. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell_builtin_read: set cc[VMIN] to 1; lineedit: don't clear c_cc[VINTR]Denys Vlasenko2012-01-151-1/+7
| | | | | | | | | | | | | First change fixes "read -n NUM". Apparently poll() won't report data availability if cc[VMIN] > 1 until there are at least cc[VMIN] bytes. function old new delta read_line_input 3885 3877 -8 shell_builtin_read 1097 1087 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-18) Total: -18 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: in standalone mode, search in $PATH if /proc/self/exe doesn't existDenys Vlasenko2011-12-201-3/+9
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: document bash's exit code too. No code changesDenys Vlasenko2011-12-161-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: add comment about bash's ENOEXEC handling. No code changesDenys Vlasenko2011-12-161-0/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cttyhack: move /sys/class/tty/console/active check to the frontDenys Vlasenko2011-10-311-13/+18
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cttyhack: print detected ctty name when called without parametersAlexander Shishkin2011-10-311-34/+42
| | | | | | | | | | | | | Sometimes there's a need to figure out the controlling tty from a shell script, for example, to obtain a line for getty. In this case it's easier to call cttyhack than trying to repeat some of the cttyhack's logic. function old new delta cttyhack_main 283 327 +44 packed_usage 28911 28915 +4 Signed-off-by: Alexander Shishkin <virtuoso@slind.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: remove SAVE_HISTORY bit, ->hist_file can be used as indicatorDenys Vlasenko2011-09-041-2/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: add support for history saving on exitDenys Vlasenko2011-09-042-0/+8
| | | | | | Based on the patch by Dennis Groenen <tj.groenen@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: fix atomic replace of history file; hush: fix $HISTFILE handlingDenys Vlasenko2011-09-042-18/+24
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cttyhack: trivial spelling/spacing fixesKevin Cernekee2011-08-161-1/+1
| | | | | Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cttyhack: remove the trailing newline when reading console name from sysfsKevin Cernekee2011-08-161-3/+5
| | | | | Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* randomconfig fixesDenys Vlasenko2011-08-091-6/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix remaining known two bugs with IFS expansion. Closes 4027.Denys Vlasenko2011-08-013-30/+61
| | | | | | | | | | | | | function old new delta expand_vars_to_list 1054 1140 +86 parse_stream 2425 2479 +54 expand_on_ifs 258 310 +52 builtin_umask 133 132 -1 done_word 820 779 -41 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/2 up/down: 192/-42) Total: 150 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: partially fix wrong expansion on $IFS (bug 4027).Denys Vlasenko2011-08-013-9/+50
| | | | | | | | | | | | | | | | In the added testcase, before patch we failed 8 out of 9 tests, now we fail only 2 (4th and 5th). function old new delta expand_on_ifs 225 258 +33 expand_vars_to_list 1038 1054 +16 o_save_ptr_helper 115 119 +4 builtin_umask 132 133 +1 o_addQstr 165 161 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/1 up/down: 54/-4) Total: 50 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cttyhack: fail gracefully if the device node is missingKevin Cernekee2011-07-131-1/+3
| | | | | Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cttyhack: check sysfs for the name of the active consoleKevin Cernekee2011-07-131-31/+48
| | | | | Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: better comment. No code changesDenys Vlasenko2011-06-011-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix a corner case of empty "do \n done" structureDenys Vlasenko2011-05-313-1/+9
| | | | | | | | | | | | The structure is: while cmd; do done bash doesn't accept it at all. We were accepting it but execution was buggy. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix misparsing of "... do eval a= ...". Closes 3721Denys Vlasenko2011-05-143-28/+53
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* fix "variable 'foo' set but not used" warningsDenys Vlasenko2011-05-131-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: install signal handlers with filled sigmaskDenys Vlasenko2011-05-121-9/+28
| | | | | | | | | | | | | function old new delta install_sighandler - 39 +39 hush_main 1001 1031 +30 builtin_trap 386 392 +6 install_sighandlers 121 123 +2 switch_off_special_sigs 87 86 -1 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 3/1 up/down: 77/-1) Total: 76 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fixes and small shrink for HUSH_JOB!=yDenys Vlasenko2011-05-121-10/+17
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: remove one sigprocmask from exit pathDenys Vlasenko2011-05-121-4/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: add forgotten {} in multi-statement if.Denys Vlasenko2011-05-121-2/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix login shell's signal handling; add -l option so that it's easier ↵Denys Vlasenko2011-05-121-32/+35
| | | | | | | | | | | | | to test function old new delta hush_main 958 1001 +43 install_special_sighandlers 47 52 +5 packed_usage 28752 28741 -11 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 48/-11) Total: 37 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: replace signal handling machineryDenys Vlasenko2011-05-111-232/+278
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With new version of signal handling, read builtin should be less buggy wrt signals. function old new delta install_sighandlers - 121 +121 switch_off_special_sigs - 84 +84 pick_sighandler - 58 +58 install_special_sighandlers - 47 +47 builtin_wait 284 319 +35 record_pending_signo - 21 +21 execvp_or_die 43 48 +5 file_get 290 288 -2 run_list 1004 998 -6 static.zero_timespec 8 - -8 sigprocmask_set 14 - -14 sigwaitinfo 23 - -23 record_signal 23 - -23 __GI_sigwaitinfo 23 - -23 sigtimedwait 25 - -25 builtin_trap 417 392 -25 __GI_sigtimedwait 25 - -25 hush_main 1003 965 -38 check_and_run_traps 263 217 -46 __rt_sigtimedwait 52 - -52 reset_traps_to_defaults 213 126 -87 init_sigmasks 198 - -198 builtin_read 536 197 -339 ------------------------------------------------------------------------------ (add/remove: 5/10 grow/shrink: 2/7 up/down: 371/-934) Total: -563 bytes text data bss dec hex filename 903075 936 17736 921747 e1093 busybox_old 902547 936 17736 921219 e0e83 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: use SA_RESTARTed signal handlers across read.Denys Vlasenko2011-05-112-29/+42
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: add tests for interrupting readDenys Vlasenko2011-05-095-4/+21
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: code shrinkDenys Vlasenko2011-05-091-59/+66
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: make read builtin interruptible.Denys Vlasenko2011-05-083-7/+114
| | | | | | | | | | | | | | | function old new delta builtin_read 185 471 +286 check_and_run_traps 200 262 +62 nonblock_immune_read 73 119 +46 sigismember - 44 +44 record_signal - 21 +21 sigisemptyset - 16 +16 ... ------------------------------------------------------------------------------ (add/remove: 5/0 grow/shrink: 7/5 up/down: 483/-46) Total: 437 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: nonblock_safe_read->nonblock_immune_read, remove unused param of ↵Denys Vlasenko2011-05-082-5/+5
| | | | | | xmalloc_reads Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix incorrect PS2 dispaly and trap handling while reading commandDenys Vlasenko2011-05-081-5/+22
| | | | | | The fix affects only !ENABLE_FEATURE_EDITING configuration Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: clear sa_flags alwaysIan Wienand2011-04-161-2/+7
| | | | | Signed-off-by: Ian Wienand <ianw@vmware.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash,hush: add ulimit -e -r (RLIMIT_NICE, RLIMIT_RTPRIO)Denys Vlasenko2011-04-041-0/+12
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash,hush: optional support for $HISTFILESIZE.Denys Vlasenko2011-03-313-3/+20
| | | | | | | | | | | | | Based on patch from Alexey Fomenko (ext-alexey.fomenko AT nokia.com) function old new delta size_from_HISTFILESIZE - 44 +44 hush_main 998 1025 +27 ash_main 1348 1374 +26 read_line_input 3361 3372 +11 new_line_input_t 17 24 +7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>