-------- CASE: control_flow break ^~~~~ test/runtime-errors.sh:253: warning: Invalid control flow at top level continue ^~~~~~~~ test/runtime-errors.sh:254: warning: Invalid control flow at top level SHOULD NOT GET HERE STATUS: 0 -------- CASE: no_such_command ZZZZZ ^~~~~ test/runtime-errors.sh:57: 'ZZZZZ' not found ZZZZZ ^~~~~ test/runtime-errors.sh:57: fatal: Exiting with status 127 (command in PID 4284) STATUS: 127 -------- CASE: no_such_command_commandsub echo $(ZZZZZ) ^~~~~ test/runtime-errors.sh:64: 'ZZZZZ' not found SHOULD NOT GET HERE STATUS: 0 -------- CASE: no_such_command_heredoc $(ZZZZZ) ^~~~~ test/runtime-errors.sh:76: 'ZZZZZ' not found one three SHOULD NOT GET HERE STATUS: 0 -------- CASE: failed_command false ^~~~~ test/runtime-errors.sh:84: fatal: Exiting with status 1 (command in PID 4291) STATUS: 1 -------- CASE: errexit_usage_error type -z ^~ test/runtime-errors.sh:93: 'type' doesn't accept flag -z type -z ^~~~ test/runtime-errors.sh:93: fatal: Exiting with status 2 (command in PID 4292) STATUS: 2 -------- CASE: errexit_subshell subshell ( echo subshell; exit 42; ) ^ test/runtime-errors.sh:100: fatal: Exiting with status 42 (subshell invoked from PID 4293) STATUS: 42 -------- CASE: errexit_dbracket [[ -n '' ]] ^~ test/runtime-errors.sh:105: fatal: Exiting with status 1 (PID 4295) STATUS: 1 -------- CASE: errexit_alias foo is a alias hi ls: cannot access '/nonexistent': No such file or directory echo hi; ls /nonexistent ^~ [ expansion of alias 'foo' ]:1: fatal: Exiting with status 2 (command in PID 4296) STATUS: 2 -------- CASE: strict_errexit_1 ===== [strict_errexit] ! { echo 1; echo 2; } ===== set -o errexit; shopt -s strict_errexit; ! { echo 1; echo 2; } ^ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.BraceGroup) ===== [strict_errexit] { echo 1; echo 2; } && true ===== set -o errexit; shopt -s strict_errexit; { echo 1; echo 2; } && true ^~ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.BraceGroup) ===== [strict_errexit] { echo 1; echo 2; } || true ===== set -o errexit; shopt -s strict_errexit; { echo 1; echo 2; } || true ^~ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.BraceGroup) ===== [strict_errexit] { echo 1; echo 2; } && true && true ===== set -o errexit; shopt -s strict_errexit; { echo 1; echo 2; } && true && true ^~ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.BraceGroup) ===== [strict_errexit] true && { echo 1; echo 2; } || true || true ===== set -o errexit; shopt -s strict_errexit; true && { echo 1; echo 2; } || true || true ^~ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.BraceGroup) ===== [strict_errexit] true && true && { echo 1; echo 2; } || true || true ===== set -o errexit; shopt -s strict_errexit; true && true && { echo 1; echo 2; } || true || true ^~ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.BraceGroup) ===== [strict_errexit] if { echo 1; echo 2; }; then echo IF; fi ===== set -o errexit; shopt -s strict_errexit; if { echo 1; echo 2; }; then echo IF; fi ^~ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.BraceGroup) ===== [strict_errexit] while { echo 1; echo 2; }; do echo WHILE; done ===== set -o errexit; shopt -s strict_errexit; while { echo 1; echo 2; }; do echo WHILE; done ^~~~~ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.BraceGroup) ===== [strict_errexit] until { echo 1; echo 2; }; do echo UNTIL; done ===== set -o errexit; shopt -s strict_errexit; until { echo 1; echo 2; }; do echo UNTIL; done ^~~~~ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.BraceGroup) STATUS: 0 -------- CASE: strict_errexit_2 ===== [strict_errexit] if ls | wc -l; then echo Pipeline; fi ===== set -o errexit; shopt -s strict_errexit; if ls | wc -l; then echo Pipeline; fi ^~ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.Pipeline) ===== [strict_errexit] if ! ls | wc -l; then echo Pipeline; fi ===== set -o errexit; shopt -s strict_errexit; if ! ls | wc -l; then echo Pipeline; fi ^~ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.Pipeline) ===== [strict_errexit] ! for x in a; do echo $x; done ===== set -o errexit; shopt -s strict_errexit; ! for x in a; do echo $x; done ^ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.DoGroup) ===== [strict_errexit] _func() { echo; }; ! _func ===== set -o errexit; shopt -s strict_errexit; _func() { echo; }; ! _func ^~~~~ [ -c flag ]:1: fatal: can't disable errexit running a function. Maybe wrap the function in a process with the at-splice pattern. ===== [strict_errexit] ! { echo brace; } ===== set -o errexit; shopt -s strict_errexit; ! { echo brace; } ^ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.BraceGroup) ===== [strict_errexit] ! ( echo subshell ) ===== set -o errexit; shopt -s strict_errexit; ! ( echo subshell ) ^ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.Subshell) ===== [strict_errexit] ! while false; do echo while; done ===== set -o errexit; shopt -s strict_errexit; ! while false; do echo while; done ^ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.WhileUntil) ===== [strict_errexit] ! if true; then false; fi ===== set -o errexit; shopt -s strict_errexit; ! if true; then false; fi ^ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.If) ===== [strict_errexit] ! case x in x) echo x;; esac ===== set -o errexit; shopt -s strict_errexit; ! case x in x) echo x;; esac ^ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.Case) ===== [strict_errexit] ! time echo hi ===== set -o errexit; shopt -s strict_errexit; ! time echo hi ^ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.TimeBlock) ===== [strict_errexit] ! echo $(echo hi) ===== set -o errexit; shopt -s strict_errexit; ! echo $(echo hi) ^ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (command.CommandList) STATUS: 0 -------- CASE: pipefail 0 false | wc -l ^~~~~ test/runtime-errors.sh:191: fatal: Exiting with status 1 (command in PID 4395) 0 false | wc -l ^ test/runtime-errors.sh:191: fatal: Exiting with status 1 (pipeline invoked from PID 4392) STATUS: 1 -------- CASE: pipefail_group echo hi | { cat; sh -c 'exit 42'; } | wc ^~ test/runtime-errors.sh:213: fatal: Exiting with status 42 (command in PID 4399) 1 1 3 echo hi | { cat; sh -c 'exit 42'; } | wc ^ test/runtime-errors.sh:213: fatal: Exiting with status 42 (pipeline invoked from PID 4397) STATUS: 42 -------- CASE: pipefail_subshell echo hi | (cat; sh -c 'exit 42') | wc ^~ test/runtime-errors.sh:221: fatal: Exiting with status 42 (command in PID 4409) echo hi | (cat; sh -c 'exit 42') | wc ^ test/runtime-errors.sh:221: fatal: Exiting with status 42 (subshell invoked from PID 4408) 1 1 3 echo hi | (cat; sh -c 'exit 42') | wc ^ test/runtime-errors.sh:221: fatal: Exiting with status 42 (pipeline invoked from PID 4406) STATUS: 42 -------- CASE: pipefail_func echo hi | f | wc ^ test/runtime-errors.sh:204: fatal: Exiting with status 42 (command in PID 4415) 1 1 3 echo hi | f | wc ^ test/runtime-errors.sh:204: fatal: Exiting with status 42 (pipeline invoked from PID 4413) STATUS: 42 -------- CASE: pipefail_while sh -c 'exit 42' ^~ test/runtime-errors.sh:233: fatal: Exiting with status 42 (command in PID 4421) 2 6 12 seq 3 | while true; do ^ test/runtime-errors.sh:229: fatal: Exiting with status 42 (pipeline invoked from PID 4419) STATUS: 42 -------- CASE: pipefail_multiple six { echo 'four'; sh -c 'exit 4'; } | ^~ test/runtime-errors.sh:246: fatal: Exiting with status 4 (command in PID 4425) { echo 'six'; sh -c 'exit 6'; } ^~ test/runtime-errors.sh:248: fatal: Exiting with status 6 (command in PID 4424) { echo 'five'; sh -c 'exit 5'; } | ^~ test/runtime-errors.sh:247: fatal: Exiting with status 5 (command in PID 4426) { echo 'four'; sh -c 'exit 4'; } | ^ test/runtime-errors.sh:246: fatal: Exiting with status 6 (pipeline invoked from PID 4424) STATUS: 6 -------- CASE: core_process echo foo > not/a/file ^ test/runtime-errors.sh:261: Can't open 'not/a/file': No such file or directory echo foo > /etc/no-perms-for-this ^ test/runtime-errors.sh:262: Can't open '/etc/no-perms-for-this': Permission denied echo hi 1>&3 ^~~ test/runtime-errors.sh:263: 3: Bad file descriptor STATUS: 1 -------- CASE: osh_state HOME=(a b) ^~~~~ test/runtime-errors.sh:269: fatal: Only strings can be exported STATUS: 1 -------- CASE: nounset echo $x ^~ test/runtime-errors.sh:320: fatal: Undefined variable 'x' STATUS: 1 -------- CASE: bad_var_ref echo ${!name} ^~~~ test/runtime-errors.sh:327: fatal: Bad indirect expansion: 'bad var name' STATUS: 1 -------- CASE: nounset_arith echo $(( x )) ^~~~ test/runtime-errors.sh:336: fatal: Undefined variable 'x' STATUS: 1 -------- CASE: divzero echo $(( 1 / 0 )) ^ [ -c flag ]:1: fatal: Divide by zero echo $(( 1 % 0 )) ^ [ -c flag ]:1: fatal: Divide by zero zero=0; echo $(( 1 / zero )) ^~~~ [ -c flag ]:1: fatal: Divide by zero zero=0; echo $(( 1 % zero )) ^~~~ [ -c flag ]:1: fatal: Divide by zero (( a = 1 / 0 )); echo non-fatal; exit 1 ^ [ -c flag ]:1: fatal: Divide by zero (( a = 1 % 0 )); echo non-fatal; exit 1 ^ [ -c flag ]:1: fatal: Divide by zero set -e; (( a = 1 / 0 )); ^ [ -c flag ]:1: fatal: Divide by zero set -e; (( a = 1 % 0 )); ^ [ -c flag ]:1: fatal: Divide by zero STATUS: 0 -------- CASE: array_arith (( a++ )) # doesn't make sense ^~ test/runtime-errors.sh:407: fatal: Can't use assignment like ++ or += on arrays STATUS: 1 -------- CASE: undef_arith (( undef[42]++ )) ^~ test/runtime-errors.sh:393: fatal: Can't assign to characters of string 'undef' STATUS: 1 -------- CASE: undef_arith2 ['2'] STATUS: 0 -------- CASE: undef_assoc_array bar STATUS: 0 -------- CASE: string_to_int_arith 5 echo $(( x + 5 )) ^ test/runtime-errors.sh:363: fatal: Invalid integer constant 'ZZZ' STATUS: 1 -------- CASE: string_to_hex 1 SHOULD NOT GET HERE STATUS: 0 -------- CASE: string_to_octal 1 SHOULD NOT GET HERE STATUS: 0 -------- CASE: string_to_intbase 0 SHOULD NOT GET HERE STATUS: 0 -------- CASE: string_to_int_bool [[ a -eq 0 ]] ^ test/runtime-errors.sh:447: fatal: Invalid integer constant 'a' STATUS: 1 -------- CASE: string_as_array foo echo "${str[@]}" ^~ test/runtime-errors.sh:511: fatal: Can't index string with @ STATUS: 1 -------- CASE: array_assign_1 s[0]=x # can't assign value ^~ test/runtime-errors.sh:483: fatal: Can't assign to items in a string STATUS: 1 -------- CASE: array_assign_2 array[0]=x ^~~~~~ test/runtime-errors.sh:488: fatal: Can't assign to readonly array STATUS: 1 -------- CASE: readonly_assign x=2 ^~ test/runtime-errors.sh:493: fatal: Can't assign to readonly value 'x' STATUS: 1 -------- CASE: multiple_assign a=1 b=2 x=42 ^~ test/runtime-errors.sh:499: fatal: Can't assign to readonly value 'x' STATUS: 1 -------- CASE: multiple_assign_2 0 STATUS: 0 -------- CASE: patsub_bad_glob echo ${x//[^]} ^ test/runtime-errors.sh:433: fatal: Error matching regex '([^])': Invalid regex syntax (func_regex_first_group_match) STATUS: 1 -------- CASE: builtin_bracket [ -t xxx ] ^~~ test/runtime-errors.sh:520: (test) Invalid file descriptor 'xxx' STATUS: 2 -------- CASE: builtin_builtin builtin ls ^~ test/runtime-errors.sh:525: 'ls' isn't a shell builtin STATUS: 1 -------- CASE: builtin_source source ^~~~~~ test/runtime-errors.sh:529: 'source' missing required argument source $bad ^~~~ test/runtime-errors.sh:532: source '/nonexistent/path' failed: No such file or directory STATUS: 1 -------- CASE: builtin_cd cd ^~ test/runtime-errors.sh:537: $HOME isn't defined cd ^~ test/runtime-errors.sh:543: $HOME shouldn't be an array cd - ^~ test/runtime-errors.sh:548: $OLDPWD not set ( cd /nonexistent ^~~~~~~~~~~~ test/runtime-errors.sh:551: cd '/nonexistent': No such file or directory STATUS: 1 -------- CASE: builtin_pushd pushd /nonexistent ^~~~~~~~~~~~ test/runtime-errors.sh:556: pushd: '/nonexistent': No such file or directory STATUS: 1 -------- CASE: builtin_popd popd # empty dir stack ^~~~ test/runtime-errors.sh:560: popd: directory stack is empty ~/git/oilshell/oil/_tmp/runtime-error-popd ~/git/oilshell/oil / ~/git/oilshell/oil/_tmp/runtime-error-popd ~/git/oilshell/oil popd ^~~~ test/runtime-errors.sh:568: popd: '/home/andy/git/oilshell/oil/_tmp/runtime-error-popd': No such file or directory STATUS: 1 -------- CASE: builtin_unset unset x a ^ test/runtime-errors.sh:576: Can't unset readonly variable 'a' unset -v x a ^ test/runtime-errors.sh:577: Can't unset readonly variable 'a' STATUS: 1 -------- CASE: builtin_alias_unalias alias zzz ^~~ test/runtime-errors.sh:581: No alias named 'zzz' unalias zzz ^~~ test/runtime-errors.sh:582: No alias named 'zzz' STATUS: 1 -------- CASE: builtin_help help zzz ^~~ test/runtime-errors.sh:586: no help topics match 'zzz' STATUS: 1 -------- CASE: builtin_trap trap ^~~~ test/runtime-errors.sh:590: 'trap' requires a code string trap EXIT ^~~~ test/runtime-errors.sh:591: 'trap' requires a signal or hook name trap zzz yyy ^~~ test/runtime-errors.sh:593: Invalid signal or hook 'yyy' STATUS: 1 -------- CASE: builtin_getopts getopts ^~~~~~~ test/runtime-errors.sh:597: 'getopts' requires an argspec getopts 'a:' ^~~~~~~ test/runtime-errors.sh:598: 'getopts' requires the name of a variable to set getopts 'a:' varname ^~~~~~~ test/runtime-errors.sh:602: getopts: option '-a' requires an argument. (getopts argv: -a) STATUS: 0 -------- CASE: builtin_wait wait 1234578 ^~~~~~~ test/runtime-errors.sh:616: 1234578 isn't a child of this shell STATUS: 127 -------- CASE: builtin_exec exec nonexistent-command 1 2 3 ^~~~~~~~~~~~~~~~~~~ test/runtime-errors.sh:620: exec: 'nonexistent-command' not found STATUS: 127 -------- CASE: strict_word_eval_warnings slice start negative echo -${s: -2}- ^~ test/runtime-errors.sh:633: warning: The start index of a string slice can't be negative: -2 -- slice length negative echo -${s: 1: -2}- ^~ test/runtime-errors.sh:637: warning: The length of a string slice can't be negative: -2 -- slice bad utf-8 [??? no location ???] warning: Invalid start of UTF-8 character -- length bad utf-8 echo ${#s} ^ test/runtime-errors.sh:647: warning: Invalid start of UTF-8 character -1 STATUS: 0 -------- CASE: strict_arith_warnings 1 1 done STATUS: 0 -------- CASE: strict_control_flow_warnings break ^~~~~ test/runtime-errors.sh:664: fatal: Unexpected 'break' (in function call) STATUS: 1 -------- CASE: control_flow_subshell 1 ( break; echo 'oops') ^~~~~ test/runtime-errors.sh:671: Loop and control flow can't be in different processes ( break; echo 'oops') ^ test/runtime-errors.sh:671: fatal: Exiting with status 1 (subshell invoked from PID 4509) STATUS: 1