aboutsummaryrefslogtreecommitdiff
path: root/shell/hush.c
AgeCommit message (Collapse)Author
2017-07-25hush: treat ${#?} as "length of $?"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-24hush: fix a case when redirect to a closed fd #1 is not restoring (closing) itDenys Vlasenko
function old new delta setup_redirects 200 245 +45 append_squirrel - 41 +41 save_fds_on_redirect 256 221 -35 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 86/-35) Total: 51 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-24hush: use mempcpy where usefulDenys Vlasenko
function old new delta o_addblock 58 42 -16 expand_one_var 1618 1555 -63 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-79) Total: -79 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-21config: deindent all help textsDenys Vlasenko
Those two spaces after tab have no effect, and always a nuisance when editing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18hush: remove contradicting size info in config helpDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18Update menuconfig items with approximate applet sizesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18hush: tweak "help" outputDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18hush: fix readonly2.tests failureDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18hush: do not assign to readonly VAR in "VAR=VAL CMD" syntax tooDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18hush: add readonly testcase, fix falloutDenys Vlasenko
function old new delta helper_export_local 185 214 +29 run_pipe 1549 1560 +11 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 40/0) Total: 40 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18hush: convert exp/ro/local parameters to bitfields in one flag paramDenys Vlasenko
function old new delta helper_export_local 174 185 +11 set_local_var 424 420 -4 run_list 1048 1044 -4 set_vars_and_save_old 88 83 -5 set_local_var_from_halves 27 22 -5 run_pipe 1554 1549 -5 builtin_export 173 168 -5 set_pwd_var 40 34 -6 builtin_readonly 70 64 -6 expand_one_var 1625 1618 -7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/9 up/down: 11/-47) Total: -36 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-17hush: HUSH_READONLY depends on HUSHDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-17hush: forgot to emit error on (failing) second "readonly VAR=VAL"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-17hush: smaller code in !READONLY configsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-17hush: implement "readonly" builtinDenys Vlasenko
function old new delta builtin_readonly - 70 +70 helper_export_local 152 174 +22 bltins1 348 360 +12 expand_one_var 1620 1625 +5 builtin_export 168 173 +5 set_pwd_var 36 40 +4 set_local_var 410 414 +4 set_vars_and_save_old 85 88 +3 set_local_var_from_halves 24 27 +3 run_pipe 1551 1554 +3 run_list 1046 1048 +2 builtin_type 116 114 -2 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 10/1 up/down: 133/-2) Total: 131 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-17hush: small fix to last commitDenys Vlasenko
die_if_script() indeed dies only in scripts! Must handle the case where it continues. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-17hush: support ${VAR:N:-M}Denys Vlasenko
function old new delta expand_one_var 1602 1615 +13 builtin_type 114 116 +2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-17shells: expand TODO comments, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-16hush: fix "cmd1 && cmd2 &" handling on NOMMUDenys Vlasenko
function old new delta done_pipe 234 238 +4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-15hush: fix and_or_and_backgrounding.tests failureDenys Vlasenko
function old new delta done_pipe 133 218 +85 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-14hush: make "wait %1" work even if the job is deadDenys Vlasenko
Example script: sleep 1 | (sleep 1;exit 3) & sleep 2 echo Zero:$? wait %1 echo Three:$? function old new delta clean_up_last_dead_job - 24 +24 process_wait_result 426 447 +21 builtin_wait 285 293 +8 insert_job_into_table 264 269 +5 builtin_jobs 68 73 +5 remove_job_from_table 59 57 -2 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/1 up/down: 63/-2) Total: 61 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-14hush: remove superfluous comparisonDenys Vlasenko
function old new delta builtin_wait 291 285 -6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-14hush: add support for "set -e"Denys Vlasenko
function old new delta run_list 978 1046 +68 o_opt_strings 24 32 +8 reset_traps_to_defaults 136 142 +6 pick_sighandler 57 60 +3 packed_usage 31772 31770 -2 hush_main 983 961 -22 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/2 up/down: 85/-24) Total: 61 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-10hush: add TODO for "set -e"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-10hush: simplify insert_job_into_table() a bitDenys Vlasenko
function old new delta done_word 767 761 -6 insert_job_into_table 325 264 -61 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 59/-126) Total: -67 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-10hush: rename a few functionsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-08hush: explain why wait5.tests is failingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-07hush: fix "(sleep 1; exit 3) & sleep 2; echo $?; wait $!; echo $?"Denys Vlasenko
function old new delta process_wait_result 414 426 +12 builtin_wait 283 291 +8 run_list 974 978 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 24/0) Total: 24 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-07hush: fix two redirection testcase failuresDenys Vlasenko
function old new delta save_fds_on_redirect 183 256 +73 fcntl_F_DUPFD - 46 +46 restore_redirects 74 96 +22 xdup_and_close 51 72 +21 setup_redirects 196 200 +4 hush_main 988 983 -5 static.C 12 - -12 run_pipe 1595 1551 -44 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 4/2 up/down: 166/-61) Total: 105 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-07main: fix the case where user has "halt" as login shell. Closes 9986Denys Vlasenko
halt::0:0::/:/sbin/halt function old new delta run_applet_and_exit 748 751 +3 run_applet_no_and_exit 467 459 -8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-06hush: add a TODO about redir3.tests failureDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-06hush: Print error messages on shift -1Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-06hush: implement negative start in the ${v: -n[:m]} idiomDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-06hush: "adopt" ash signal4.testsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-06hush: correctly handle quoting in "case" even if !BASH_PATTERN_SUBSTDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-05hush: fix quoted_punct.tests failureDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-03fixes for bugs found by make_single_applets.shDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-03msh: delete this appletDenys Vlasenko
It's deprecated since 2009 and interferes with make_single_applets.sh tests. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-03randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-05-22ash,hush: fix SIGCHLD interrupting read builtinDenys Vlasenko
function old new delta readcmd 169 217 +48 shell_builtin_read 1087 1097 +10 localcmd 366 364 -2 builtin_read 197 193 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 58/-6) Total: 52 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-17Spelling fixes in comments, documentation, tests and examplesDenys Vlasenko
By klemens <ka7@github.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-29*: add comment about APPLET_ODDNAME formatDenys Vlasenko
It confused me more than once Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-11hush: reinstate [[ builtinDenys Vlasenko
Mike deleted it: commit 39456a18a104b228de240b265bd943251219849d Author: Mike Frysinger <vapier@gentoo.org> Date: Sat Mar 28 12:21:57 2009 +0000 stop lying about [[ test support probably because it was not properly ifdefed around, and was enabled even when bash compat is off. I just tested it - it works: $ [ *.diff = z.diff ]; echo $? 0 $ [[ *.diff = z.diff ]]; echo $? 1 Of course, not all numerous bash tricks of [[ ]] are implemented... function old new delta bltins2 60 72 +12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-11hush: split bash compatible extensions into separate defines. No code changesKang-Che Sung
Splitting these options makes it self-documenting about what bash-compatible features we have. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10hush: shorten output of "help" builtinDenys Vlasenko
text data bss dec hex filename 891272 485 6856 898613 db635 busybox_old 891232 485 6856 898573 db60d busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10hush: reorder builtins (cd and pwd ought to be close, etc), no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10shells: make hush test optional, rename ASH_BUILTIN_foo -> ASH_fooDenys Vlasenko
This makes hash and ash more symmetrical wrt config menu and config options. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10Big cleanup in config help and descriptionDenys Vlasenko
Redundant help texts (one which only repeats the description) are deleted. Descriptions and help texts are trimmed. Some config options are moved, even across menus. No config option _names_ are changed. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09hush: make echo builtin optionalDenys Vlasenko
It's a bit overkill (who would want it off?) but ash already has it configurable. Let's be symmetric. Also tweak kbuild logic to use ASH_BUILTIN_ECHO to select echo.o, not ASH. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09hush: fix a bug in argv restoration after sourcing a fileDenys Vlasenko
if sourced file "shift"ed argvs so that $1 is NULL, restore wasn't done. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>