aboutsummaryrefslogtreecommitdiff
path: root/shell/hush_test
AgeCommit message (Collapse)Author
2016-10-02hush testsuite: add many tests from ash testsuiteDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-02hush testsuite: add glob_dir.testsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-02ash: expand: Fixed "$@" expansion when EXP_FULL is falseDenys Vlasenko
Upstream commit: Date: Thu, 1 Jan 2015 07:53:10 +1100 expand: Fixed "$@" expansion when EXP_FULL is false The commit 3c06acdac0b1ba0e0acdda513a57ee6e31385dce ([EXPAND] Split unquoted $@/$* correctly when IFS is set but empty) broke the case where $@ is in quotes and EXP_FULL is false. In that case we should still emit IFS as field splitting is not performed. Reported-by: Juergen Daubert <jue@jue.li> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-01ash,hush: add a test that "continue" does not cripple trapsDenys Vlasenko
Both shells pass this test. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-01ash testsuite: add return_in_trap1.testsDenys Vlasenko
Currently it fails Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-01hush: 'return' should have effect earlierDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-01ash: [EXPAND] Do not split quoted VSLENGTH and VSTRIMDenys Vlasenko
Upstream patch: Date: Wed, 8 Oct 2014 15:42:08 +0800 [EXPAND] Do not split quoted VSLENGTH and VSTRIM Currently VSLENGTH and VSTRIM* are field-split even within quotes. This is obviously wrong. This patch fixes that. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-01ash: [EXPAND] Split unquoted $@/$* correctly when IFS is set but emptyDenys Vlasenko
Upstream commit: Date: Wed, 8 Oct 2014 15:24:23 +0800 [EXPAND] Split unquoted $@/$* correctly when IFS is set but empty Currently we do not field-split $@/$* when it isn't quoted and IFS is set but empty. This is obviously wrong. This patch fixes this. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-01hush: add func6.testsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-29shell testsuite: add trailing newline to var_unbackslash1.testsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-29ash: fix arithmetic closing )) split by backslash-newlineDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-29hush: rework input char buffering to allow more than one-deep peekDenys Vlasenko
This fixes backslash+newline continuation in $VAR\ NAME construct. (ash has a bug there as well). function old new delta file_peek2 - 74 +74 parse_dollar 746 773 +27 expand_vars_to_list 1143 1167 +24 setup_string_in_str 32 46 +14 setup_file_in_str 33 47 +14 file_get 264 278 +14 static_peek2 - 7 +7 file_peek 91 72 -19 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 5/1 up/down: 174/-19) Total: 155 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-29hush: fix 'eval ""' handlingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-29hush: fix ". EMPTY_LINE" not setting $? to 0Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-29ash: [EVAL] Make eval with empty arguments return 0Denys Vlasenko
This is a backport of upstream commit: [EVAL] Make eval with empty arguments return 0 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-28ash: eval: Return status in eval functionsDenys Vlasenko
Backported from dash: eval: Return status in eval functions The exit status is currently clobbered too early for case statements and loops. This patch fixes it by making the eval functions return the current exit status and setting them in one place -- evaltree. Harald van Dijk pointed out a number of bugs in the original patch. function old new delta evalcommand 1226 1242 +16 cmdloop 383 398 +15 evalfor 223 227 +4 evalcase 271 275 +4 localcmd 348 350 +2 evaltreenr 927 928 +1 evaltree 927 928 +1 evalsubshell 150 151 +1 evalpipe 356 357 +1 parse_command 1585 1584 -1 evalloop 177 164 -13 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 9/2 up/down: 45/-14) Total: 31 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-22hush: fix "redirects can close script fd" bugDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-19hush: fix a bug in FEATURE_SH_STANDALONE=y config. Closes 9186Denys Vlasenko
Run this in a "sh SCRIPT": sha256sum /dev/null echo END sha256sum is a NOEXEC applet. It runs in a forked child. Then child exit()s. By this time, entire script is read, and buffered in a FILE object from fopen("SCRIPT"). But fgetc() did not consume entire input. exit() lseeks back by -9 bytes, from <eof> to 'e' in 'echo'. (this may be libc-specific). This change of fd position *is shared with the parent*! Now parent can read more, and it thinks there is another "echo END". End result: two "echo END"s are run. Fix this by _exit()ing instead. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-11-04hush-misc/func_args1.tests: remove "UNFIXED BUG", it does not failDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-29hush: copy for.tests from ash testsuiteDenys Vlasenko
This test passes for hush Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-13typo fixDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-09-04hush: fix a nommu bug where a part of function body is lost if run in a pipeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-09-04ash,hush: add a test which fails for ash since commit 549deabDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-18hush: add recent ash tests to hush testsuite too (they all pass for hush)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-04-18hush: document buggy handling of duplicate "local"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-13hush: make ${#var} unicode-awareDenys Vlasenko
This mimics bash Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-04-07hush: fix for "while false && true; do echo BUG; break; done". closes 6170Denys Vlasenko
function old new delta run_list 959 941 -18 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-17hush: source builtin should override $N only if it has argsDenys Vlasenko
function old new delta builtin_source 174 184 +10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-01hush: fix remaining known two bugs with IFS expansion. Closes 4027.Denys Vlasenko
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>
2011-08-01hush: partially fix wrong expansion on $IFS (bug 4027).Denys Vlasenko
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>
2011-05-31hush: fix a corner case of empty "do \n done" structureDenys Vlasenko
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>
2011-05-14hush: fix misparsing of "... do eval a= ...". Closes 3721Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-09hush: add tests for interrupting readDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-24hush: document a bug about aborting on sourced file error when non-interactiveDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-24hush: fix a case where return in sourced file has no effectDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-21slightly better wording in commentsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-21ash: fix ash-signals/signal8 testcase failureDenys Vlasenko
function old new delta killcmd 109 224 +115 kill_main 882 910 +28 changepath 194 195 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 144/0) Total: 144 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-07echo: do not retry on write errorsDenys Vlasenko
function old new delta echo_main 297 336 +39 stpcpy - 22 +22 run_pipe 1561 1566 +5 pseudo_exec_argv 187 192 +5 hush_exit 75 80 +5 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 4/0 up/down: 98/0) Total: 76 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-22hush: fix improper handling of newline and hash chars in few corner casesDenys Vlasenko
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-11-14hush: add support for "set -o pipefail"Denys Vlasenko
function old new delta checkjobs 467 517 +50 builtin_set 259 286 +27 o_opt_strings - 10 +10 hush_main 1011 1013 +2 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 3/0 up/down: 89/0) Total: 89 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-03hush: add brace expansion testcaseDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-09-16shell/math: deconvolute and explain ?: handling. Give better error messageDenys Vlasenko
function old new delta arith_apply 1271 1283 +12 Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-15shell/math: return string error indicator, not integerDenys Vlasenko
function old new delta expand_and_evaluate_arith 87 106 +19 expand_one_var 1563 1570 +7 arith 12 18 +6 evaluate_string 678 680 +2 arith_apply 1269 1271 +2 builtin_umask 133 132 -1 ash_arith 118 75 -43 expand_vars_to_list 1094 1038 -56 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/3 up/down: 36/-100) Total: -64 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12hush: fix EXIT trap display inside exit trap handlerDenys Vlasenko
function old new delta hush_exit 84 78 -6 Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12hush: fix handling of \" in quoted/unquoted `cmd`Denys Vlasenko
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-10hush: do fewer strdups in % and hash expansionsDenys Vlasenko
function old new delta builtin_umask 133 132 -1 expand_one_var 1552 1543 -9 Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-10hush: fixes to testsuiteDenys Vlasenko
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-10hush: fix var_bash5.tests failureDenys Vlasenko
function old new delta expand_one_var 1513 1552 +39 expand_pseudo_dquoted 118 135 +17 expand_string_to_string 110 126 +16 setup_heredoc 298 308 +10 expand_and_evaluate_arith 69 79 +10 parse_stream_dquoted 233 241 +8 setup_redirects 220 225 +5 run_list 956 961 +5 expand_assignments 76 81 +5 run_pipe 1587 1590 +3 parse_stream 2371 2374 +3 builtin_umask 132 133 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 12/0 up/down: 122/0) Total: 122 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-09hush: make parse_dollar flag quited status regardless of glob escaping statusDenys Vlasenko
function old new delta parse_stream_dquoted 228 233 +5 parse_stream 2369 2371 +2 parse_dollar 730 717 -13 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 7/-13) Total: -6 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06hush: fix another corner case with backslashes in heredocsDenys Vlasenko
function old new delta parse_stream 2395 2432 +37 Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>