aboutsummaryrefslogtreecommitdiff
path: root/shell/hush_test/hush-misc (follow)
Commit message (Collapse)AuthorAgeFilesLines
* hush: fix handling of \^C and "^C"Denys Vlasenko2021-11-234-0/+6
| | | | | | | | | | | function old new delta parse_stream 2238 2252 +14 encode_string 243 256 +13 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 27/0) Total: 27 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> (cherry picked from commit 1b7a9b68d0e9aa19147d7fda16eb9a6b54156985)
* typo fixDenys Vlasenko2020-12-251-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix this case: echo "SCRIPT" | hushDenys Vlasenko2020-12-252-0/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: output bash-compat killing signal namesDenys Vlasenko2020-10-241-2/+2
| | | | | | | | | This significantly syncronises ash-signals and hush-signals tests. function old new delta process_wait_result 449 450 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell: add testsuite for "wait $pid" waiting for other tasksDenys Vlasenko2020-09-292-0/+9
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shells: fix exitcode_trapN tests to avoid racesDenys Vlasenko2020-02-262-4/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: make "exit" in trap use pre-trap exitcode - fix for nested trapDenys Vlasenko2020-02-212-0/+13
| | | | | | | function old new delta check_and_run_traps 276 278 +2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: implement "return NUM in trap sets $? after trap"Denys Vlasenko2020-02-206-0/+34
| | | | | | | | | | | | | function old new delta builtin_return 47 67 +20 check_and_run_traps 243 259 +16 run_pipe 1583 1597 +14 hush_main 1076 1086 +10 run_list 1054 1055 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/0 up/down: 61/0) Total: 61 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash,hush: testcase for "exit" without arguments in a trapDenys Vlasenko2020-02-192-0/+10
| | | | | | hush fails this one Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shells: add tests for backslashes in export VAR=VALDenys Vlasenko2019-05-142-0/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: eval: Variable assignments on functions are no longer persistentDenys Vlasenko2018-08-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream commit: Date: Wed, 4 Apr 2018 17:54:01 +0800 eval: Variable assignments on functions are no longer persistent Dirk Fieldhouse <fieldhouse@gmx.net> wrote: > In POSIX.1-2017 ("simultaneously IEEE Std 1003.1™-2017 and The Open > Group Technical Standard Base Specifications, Issue 7") > <http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09>, > we read under '2.9.1 Simple Commands' > > "Variable assignments shall be performed as follows: > ... > - If the command name is a standard utility implemented as a function > (see XBD Utility), the effect of variable assignments shall be as if the > utility was not implemented as a function. > ... > - If the command name is a function that is not a standard utility > implemented as a function, variable assignments shall affect the current > execution environment during the execution of the function. It is > unspecified: > > * Whether or not the variable assignments persist after the > completion of the function > > * Whether or not the variables gain the export attribute during > the execution of the function > > * Whether or not export attributes gained as a result of the > variable assignments persist after the completion of the function (if > variable assignments persist after the completion of the function)" POSIX used to require the current dash behaviour. However, you're right that this is no longer the case. This patch will remove the persistence of the variable assignment. I have considered the exporting the variables during the function execution but have decided against it because: 1) It makes the code bigger. 2) dash has never done this in the past. 3) You cannot use this portably anyway. Reported-by: Dirk Fieldhouse <fieldhouse@gmx.net> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> function old new delta evalcommand 1606 1635 +29 evalcase 313 317 +4 evalfun 280 268 -12 pushlocalvars 48 - -48 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 2/1 up/down: 33/-60) Total: -27 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix another case where empty "for" wasn't setting exitcode to 0Denys Vlasenko2018-07-282-0/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: support "f() (cmd)" functionsDenys Vlasenko2018-04-031-3/+2
| | | | | | | | | Many other shells support this construct function old new delta parse_stream 2950 3018 +68 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix "set -e; false || x=1; echo OK"Denys Vlasenko2018-04-032-0/+14
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix raw ^C handlisg in single-quoted stringsDenys Vlasenko2018-01-134-6/+5
| | | | | | | function old new delta parse_stream 2719 2754 +35 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: add command2.tests from ash testsDenys Vlasenko2018-01-122-0/+8
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix handling of ^C in evalDenys Vlasenko2018-01-112-0/+5
| | | | | | | | | | | 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>
* hush: fix handling of raw ^C in scripts: "echo ^C"Denys Vlasenko2018-01-112-0/+4
| | | | | | | | 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>
* hush: fix "true | func_with_return" not allowing return.Denys Vlasenko2017-07-314-0/+8
| | | | | | | function old new delta pseudo_exec_argv 305 312 +7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: functions have priority over builtins (!)Denys Vlasenko2017-07-312-0/+10
| | | | | | | | | | function old new delta pseudo_exec_argv 291 305 +14 run_pipe 1560 1555 -5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 14/-5) Total: 9 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell: some additions to *sh-misc/* testsDenys Vlasenko2017-07-241-0/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: add support for "set -e"Denys Vlasenko2017-07-142-0/+6
| | | | | | | | | | | | | | 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>
* hush: fix "(sleep 1; exit 3) & sleep 2; echo $?; wait $!; echo $?"Denys Vlasenko2017-07-072-0/+8
| | | | | | | | | | | 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>
* hush: Print error messages on shift -1Denys Vlasenko2017-07-062-0/+20
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell: remove duplicate sigint1.tests (another copies are in signals/)Denys Vlasenko2017-07-062-42/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: add tickquote1.tests from ash testsuiteDenys Vlasenko2017-07-062-0/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Spelling fixes in comments, documentation, tests and examplesDenys Vlasenko2017-04-171-1/+1
| | | | | | By klemens <ka7@github.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix a bug in argv restoration after sourcing a fileDenys Vlasenko2017-01-092-0/+16
| | | | | | if sourced file "shift"ed argvs so that $1 is NULL, restore wasn't done. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: fix error code regressionRon Yorston2017-01-032-0/+16
| | | | | | | | | | | | | | | | | | | | | | The commit 'ash,hush: set exit code 127 in "sh /does/not/exist" case' only partly implemented the dash commit '[ERROR] Allow the originator of EXERROR to set the exit status'. This resulted in incorrect error codes for a syntax error: $ ) $ echo $? 0 or a redirection error for a special builtin: $ rm -f xxx $ eval cat <xxx $ echo $? 0 Signed-off-by: Ron Yorston <rmy@pobox.com> Reported-by: Martijn Dekker <martijn@inlv.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: rework "wait %jobspec" to work in non-interactive shells tooDenys Vlasenko2016-11-084-0/+10
| | | | | | | | | Also add tests. wait5.tests so far fails (but works for ash and dash). function old new delta builtin_wait 305 283 -22 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: allow { cmd } to not be terminated by semicolon in some casesDenys Vlasenko2016-11-042-0/+16
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix "wait PID"Denys Vlasenko2016-10-286-0/+16
| | | | | | | | | | | | | | | | | It was not properly interruptible, and did not update job status (the exited processes were still thought of as running). function old new delta process_wait_result - 453 +453 wait_for_child_or_signal - 199 +199 run_list 996 1002 +6 checkjobs_and_fg_shell 41 43 +2 builtin_wait 328 215 -113 checkjobs 516 142 -374 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 2/2 up/down: 660/-487) Total: 173 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sh testsuite: add tests for exitcode on failure to execDenys Vlasenko2016-10-034-0/+8
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush testsuite: fix another false positiveDenys Vlasenko2016-10-032-2/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hust testsuite: fix a false positiveDenys Vlasenko2016-10-031-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash testsuite: add most of hust tests which pass for ashDenys Vlasenko2016-10-031-0/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sh testsuite: sync ash-misc/source* and hush-misc/source*Denys Vlasenko2016-10-028-27/+38
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sh testsuite: create hush-redir/* and move files aroundDenys Vlasenko2016-10-0214-237/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sh testsuite: create hush-heredoc/* and move files aroundDenys Vlasenko2016-10-0212-185/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush testsuite: add many tests from ash testsuiteDenys Vlasenko2016-10-028-0/+35
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: add func6.testsDenys Vlasenko2016-10-012-0/+13
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix 'eval ""' handlingDenys Vlasenko2016-09-292-0/+7
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix ". EMPTY_LINE" not setting $? to 0Denys Vlasenko2016-09-292-0/+8
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: [EVAL] Make eval with empty arguments return 0Denys Vlasenko2016-09-292-0/+5
| | | | | | | | This is a backport of upstream commit: [EVAL] Make eval with empty arguments return 0 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: eval: Return status in eval functionsDenys Vlasenko2016-09-282-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* hush: fix "redirects can close script fd" bugDenys Vlasenko2016-08-222-0/+30
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush-misc/func_args1.tests: remove "UNFIXED BUG", it does not failDenys Vlasenko2015-11-041-2/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: copy for.tests from ash testsuiteDenys Vlasenko2015-10-292-0/+6
| | | | | | This test passes for hush Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* typo fixDenys Vlasenko2015-10-131-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix a nommu bug where a part of function body is lost if run in a pipeDenys Vlasenko2015-09-042-0/+17
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>