aboutsummaryrefslogtreecommitdiff
path: root/shell
AgeCommit message (Collapse)Author
2018-01-30hush: protect against self-modifying trap codeDenys Vlasenko
function old new delta check_and_run_traps 211 236 +25 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-28ash: make it possible to disable "const global ptr" optimizationDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-28shell: handle $((NUM++...) like bash does. Closes 10706Denys Vlasenko
function old new delta evaluate_string 680 729 +49 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-27ash: add LINENO supportDenys Vlasenko
This patch is a backport from dash of the combination of: [SHELL] Add preliminary LINENO support [VAR] Fix varinit ordering that broke fc [SHELL] Improve LINENO support function old new delta parse_command 1604 1677 +73 calcsize 156 223 +67 copynode 196 258 +62 evalcommand 1546 1606 +60 ash_main 1046 1103 +57 lookupvar 51 106 +55 evalcase 269 317 +48 evaltree 501 547 +46 evalfor 156 200 +44 evalsubshell 156 195 +39 raise_error_syntax 11 29 +18 varinit_data 120 132 +12 evalfun 270 280 +10 funcline - 4 +4 cmdtxt 569 572 +3 trapcmd 306 304 -2 ash_vmsg 153 150 -3 startlinno 4 - -4 funcnest 4 - -4 xxreadtoken 263 250 -13 readtoken1 2645 2602 -43 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 14/4 up/down: 598/-69) Total: 529 bytes text data bss dec hex filename 932834 481 6864 940179 e5893 busybox_old 933375 481 6856 940712 e5aa8 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-27hush: add HUSH_BASH_SOURCE_CURDIR config option, to be on par with ashDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-27hush: fix dot builtin to not search current directoryDenys Vlasenko
function old new delta builtin_source 182 209 +27 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-26ash: introduce a config option to search current directory for sourced filesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-25ash testsuite: add two hush tests from last commitDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-25hush: fix two corner cases in ${v/pattern/repl}. Closes 10686Denys Vlasenko
function old new delta expand_one_var 1592 1618 +26 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-25hush: fix handling of $_ (so far it's an ordinary variable, no special meaning)Denys Vlasenko
function old new delta parse_dollar 820 779 -41 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-24ash: add support for command_not_found_handle hook function (bashism)William Pitcock
This implements support for the command_not_found_handle hook function, which is useful for allowing package managers to suggest packages which could provide the command. Unlike bash, however, we ignore exit codes from the hook function and always return the correct POSIX error code (EX_NOTFOUND). function old new delta find_command 911 990 +79 Signed-off-by: William Pitcock <nenolod@dereferenced.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-19hush: fix a case where EXIT trap may modify its code mid-flightDenys Vlasenko
function old new delta hush_exit 93 99 +6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-19hush: fix build if !BASH_LINENO_VARDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-19hush: implement $LINENO bashismDenys Vlasenko
function old new delta run_pipe 1697 1774 +77 unset_local_var_len 258 301 +43 hush_main 1009 1051 +42 set_local_var 516 554 +38 parse_and_run_file 42 75 +33 i_getch 96 116 +20 .rodata 18858 18876 +18 done_command 106 122 +16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 8/0 up/down: 287/0) Total: 287 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-15ash: a bit of NOFORK code should only be active if FEATURE_SH_STANDALONE=yDenys Vlasenko
function old new delta evalcommand 1546 1420 -126 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-13shell: echo ${?:0} was fixed sometime ago, enable it in testsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-13hush: fix raw ^C handlisg in single-quoted stringsDenys Vlasenko
function old new delta parse_stream 2719 2754 +35 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-12hush: add command2.tests from ash testsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-12hush: tweak command -vV printing code, no logic changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-12hush: implement "command -v -V"Denys Vlasenko
function old new delta pseudo_exec_argv 231 374 +143 if_command_vV_print_and_exit - 127 +127 builtin_set 267 273 +6 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/0 up/down: 276/0) Total: 276 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-11hush: implement "command" builtin (no options are supported yet)Denys Vlasenko
function old new delta pseudo_exec_argv 194 231 +37 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-11hush: fix handling of ^C in evalDenys Vlasenko
function old new delta run_list 1044 1259 +215 builtin_eval 45 126 +81 expand_strvec_to_string 91 - -91 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 2/0 up/down: 296/-91) Total: 205 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-11hush: fix handling of raw ^C in scripts: "echo ^C"Denys Vlasenko
function old new delta expand_vars_to_list 1133 1187 +54 parse_stream 2690 2719 +29 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-11hush: remove dead codeDenys Vlasenko
function old new delta done_word 761 711 -50 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-10ash: ALWAYS_INLINE grabstackblock()Denys Vlasenko
function old new delta grabstackblock 5 - -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-10ash: make ${v:N:M} more robust for very large M by clamping to MIN/MAX_INTDenys Vlasenko
Before this patch, "${v:2:0x100000001}" = "${v:2:1}", and similarly, constructs like "${v:2:9999999999}" may give wrong result due to int overflows. function old new delta substr_atoi - 43 +43 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-09ash: add comment explaining last changeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-09ash: fix var_bash5.tests - ${VAR/pattern/repl} constructDenys Vlasenko
function old new delta subevalvar 1198 1279 +81 rmescapes 308 330 +22 preglob 8 10 +2 parsefname 152 154 +2 expandarg 973 975 +2 argstr 1144 1146 +2 mklocal 290 288 -2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 6/1 up/down: 111/-2) Total: 109 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-07ash: fail if 'shift' operand is out of rangeIngo van Lil
If the numeric argument passed to ash's 'shift' built-in is greater than '$#' the command performs no operation and exits successfully. It should return a non-zero exit code instead: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#shift This is consistent with bash and hush. function old new delta shiftcmd 122 120 -2 Signed-off-by: Ingo van Lil <inguin@gmx.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-12-31randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-11-03ash: fix nofork bug where environment is not properly passed to a commandDenys Vlasenko
function old new delta listvars 144 252 +108 evalcommand 1500 1546 +46 showvars 142 147 +5 shellexec 242 245 +3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 162/0) Total: 162 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-11-02ash: retain envvars with bad names in initial environment. Closes 10231Denys Vlasenko
Reworks "ash: [VAR] Sanitise environment variable names on entry" commit. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-10-22hush: fix comment parsing in `cmd`, closes 10421Denys Vlasenko
function old new delta parse_stream 2692 2690 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-10-12whitespace fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-10-12typo fixDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-10-12ash: survive failures in $PS1 expansion. Closes 10371Denys Vlasenko
function old new delta expandstr 120 209 +89 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-29use %m printf specifier where appropriateDenys Vlasenko
function old new delta out 85 75 -10 udhcpd_main 1472 1461 -11 open_stdio_to_tty 98 85 -13 init_exec 245 232 -13 udhcpc_main 2763 2749 -14 do_cmd 4771 4755 -16 status_line_bold_errno 32 14 -18 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-95) Total: -95 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-18regularize format of source file headers, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-29hush: fix false positive in unset.testsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-29hush: GETOPT_RESET() _after_ getopts too.Denys Vlasenko
NOEXEC'ed applets which use getopt() need this. function old new delta builtin_getopts 403 413 +10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-29hush: reuse "OPTIND=..." stringDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-29hush: fix "getopts" builtin to not be upset by other builtins calling getopt()Denys Vlasenko
function old new delta builtin_getopts 363 403 +40 unset_local_var_len 185 215 +30 set_local_var 440 466 +26 reset_traps_to_defaults 151 157 +6 pseudo_exec_argv 320 326 +6 install_special_sighandlers 52 58 +6 pick_sighandler 62 65 +3 execvp_or_die 85 88 +3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 8/0 up/down: 120/0) Total: 120 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-23ash: more s/error/perror/ for better error reportingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-23ash: when cd fails, say whyJohannes Schindelin
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-23ash: report reason when a script file could not be openedJohannes Schindelin
It is always nicer to give the user some sort of indication why an operation failed. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-17ash: stage backported LINENO support as a separate patchDenys Vlasenko
Looks biggish and not particularly useful, but may be easier to just eat the impact if future backports from dash would be otherwise increasingly difficult. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-17hush: trivial code shrink in builtin_getoptsDenys Vlasenko
function old new delta builtin_getopts 368 363 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-15ash: unset OPTARG if getopts exits 1, support OPTERR=0 behaviorDenys Vlasenko
function old new delta getoptscmd 522 547 +25 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-15ash,hush: comment and debug tweaks, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-14ash: one "current line = 1" might be missing, fix thatDenys Vlasenko
I'm not sure this is necessary, but dash has this init here. Just in case, do it too. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>