aboutsummaryrefslogtreecommitdiff
path: root/shell/ash_test/ash-misc (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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-246-0/+30
| | | | 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-061-1/+1
| | | | 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-061-1/+1
| | | | 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>
* ash testsuite: fix false positivesDenys Vlasenko2016-10-072-2/+2
| | | | 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>
* ash testsuite: add most of hust tests which pass for ashDenys Vlasenko2016-10-0376-0/+607
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sh testsuite: sync ash-misc/source* and hush-misc/source*Denys Vlasenko2016-10-022-0/+12
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: fix "return N" not setting $? in loop conditionalsDenys Vlasenko2016-10-012-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream commit 1: Date: Mon, 6 Oct 2014 20:45:04 +0800 [EVAL] Move common skipcount logic into skiploop The functions evalloop and evalfor share the logic on checking and updating skipcount. This patch moves that into the helper function skiploop. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Upstream commit 2: Date: Mon, 6 Oct 2014 21:22:43 +0800 [BUILTIN] Allow return in loop conditional to set exit status https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=332954 When return is used in a loop conditional the exit status will be lost because we always set the exit status at the end of the loop to that of the last command executed in the body. This is counterintuitive and contrary to what most other shells do. This patch fixes this by always preserving the exit status of return when it is used in a loop conditional. The patch was originally written by Gerrit Pape <pape@smarden.org>. Reported-by: Stephane Chazelas <stephane_chazelas@yahoo.fr> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> 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>
* ash: exit after subshell error when errexit option is setRostislav Skudnov2016-09-172-0/+6
| | | | | | | | | | | When "set -e" option is on, shell must exit when any command fails, including compound commands of the form (compound-list) executed in a subshell. Bash and dash shells have this behaviour. Also add a corresponding testcase. Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: add support for bash 'function' keywordRon Yorston2015-11-042-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Where the POSIX shell allows functions to be defined as: name () compound-command [ redirections ] bash adds the alternative syntax: function name [()] compound-command [ redirections ] Implement this in ash's bash compatibility mode. Most compound commands work (for/while/until/if/case/[[]]/{}); one exception is: function f (echo "no way!") The other two variants work: f() (echo "ok") function f() (echo "also ok") function old new delta parse_command 1555 1744 +189 tokname_array 232 240 +8 .rodata 155612 155566 -46 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 197/-46) Total: 151 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush-misc/func_args1.tests: remove "UNFIXED BUG", it does not failDenys Vlasenko2015-11-041-1/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: copy function tests from hush testsuiteRon Yorston2015-11-0416-0/+119
| | | | | Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: add tests for failures of the exec and command builtinsRon Yorston2015-10-304-0/+13
| | | | | | | | | | | | The exec builtin should return an exit status of 127 if the command can't be found. It doesn't: it returns 2. If the command builtin is used to source a script that runs a second script that doesn't exist ash should issue an error. Instead it seg faults. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: only allow local variables in functionsRon Yorston2015-10-292-0/+2
| | | | | Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: respect -p flag when command builtin is run with -v/-VRon Yorston2015-10-292-0/+2
| | | | | | | | | | | | | | | | | | The command builtin should only check the default path, not $PATH, when the -p flag is used along with -v/-V. Based on commits 65ae84b (by Harald van Dijk) and 29ee27d (by Herbert Xu) from git://git.kernel.org/pub/scm/utils/dash/dash.git). function old new delta commandcmd 72 87 +15 describe_command 437 450 +13 typecmd 84 86 +2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 30/0) Total: 30 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: allow newline after variable name in for loopRon Yorston2015-10-292-0/+6
| | | | | | | | | | | | | | | | Newline is a valid delimiter between the variable name and `in` keyword in for loops. Based on commit 22e8fb4 from git://git.kernel.org/pub/scm/utils/dash/dash.git by Herbert Xu. function old new delta parse_command 1568 1563 -5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5) Total: -5 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* fix file modeDenys Vlasenko2015-07-131-0/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: remove parsebackquote flagRon Yorston2015-07-132-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 503a0b8 from git://git.kernel.org/pub/scm/utils/dash/dash.git by Herbert Xu says: >The parsebackquote flag is only used in a test where it always has the >value zero. So we can remove it altogether. The first statement is incorrect: parsebackquote is non-zero when backquotes (as opposed to $(...)) are used for command substitution. It is possible for the test to be executed with parsebackquote != 0 in that case. The test is question checks whether quotes have been closed, raising the error "unterminated quoted string" if they haven't. There seems to be no good reason to allow unclosed quotes within backquotes. Bash, hush and dash (after commit 503a0b8) all treat the following as an error: XX=`"pwd` whereas BusyBox ash doesn't. It just ignores the unclosed quote and executes pwd. So, parsebackquote should be removed but not for the reason stated. function old new delta parsebackquote 1 - -1 readtoken1 3222 3182 -40 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-41) Total: -41 bytes Signed-off-by: Ron Yorston <rmy@frippery.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: make "locak VAR" unset VAR (bash does that)Denys Vlasenko2014-03-162-0/+15
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* echo: do not retry on write errorsDenys Vlasenko2011-02-072-0/+9
| | | | | | | | | | | | | 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>
* ash: fix ". empty_file" exitcode. +5 bytesDenys Vlasenko2010-05-171-1/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: add two testcases for (not yet fixed) ash bugsDenys Vlasenko2010-05-172-0/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* fix bug 1087. Fix by Leonid (lly.dev AT gmail.com)Denys Vlasenko2010-02-212-0/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: fix . builtinDenys Vlasenko2009-06-142-0/+7
| | | | | | Also, move [[ ]] comment to test.c and expand it Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: better fix for ash -c 'echo 5&' and ash -c 'sleep 5&'Denis Vlasenko2008-11-282-0/+10
| | | | | with testcase
* ash: bash compat: "shift $BIGNUM" is equivalent to "shift 1"Denis Vlasenko2008-07-302-0/+19