-------- CASE: control_flow break ^~~~~ test/runtime-errors.sh:282: warning: Invalid control flow at top level continue ^~~~~~~~ test/runtime-errors.sh:283: warning: Invalid control flow at top level SHOULD NOT GET HERE STATUS: 1 -------- CASE: strict_errexit_1 ===== [strict_errexit] ! { echo 1; echo 2; } ===== 1 2 ===== [strict_errexit] { echo 1; echo 2; } && true ===== set -o errexit; shopt -s strict_errexit; { echo 1; echo 2; } && true ^ [ -c flag ]:1: fatal: strict_errexit only allows simple commands (got command.BraceGroup). Hint: use 'run'. ===== [strict_errexit] { echo 1; echo 2; } || true ===== set -o errexit; shopt -s strict_errexit; { echo 1; echo 2; } || true ^ [ -c flag ]:1: fatal: strict_errexit only allows simple commands (got command.BraceGroup). Hint: use 'run'. ===== [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: strict_errexit only allows simple commands (got command.BraceGroup). Hint: use 'run'. ===== [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: strict_errexit only allows simple commands (got command.BraceGroup). Hint: use 'run'. ===== [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: strict_errexit only allows simple commands (got command.BraceGroup). Hint: use 'run'. ===== [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: strict_errexit only allows simple commands (got command.Sentence). Hint: use 'run'. ===== [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: strict_errexit only allows simple commands (got command.Sentence). Hint: use 'run'. ===== [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: strict_errexit only allows simple commands (got command.Sentence). Hint: use 'run'. -------- CASE: strict_errexit_2 ===== [strict_errexit] ! for x in a; do echo $x; done ===== a ===== [strict_errexit] _func() { echo; }; ! _func ===== set -o errexit; shopt -s strict_errexit; _func() { echo; }; ! _func ^ [ -c flag ]:1: errexit was disabled for this construct set -o errexit; shopt -s strict_errexit; _func() { echo; }; ! _func ^~~~~ [ -c flag ]:1: fatal: Can't run a proc while errexit is disabled. Use 'run' or wrap it in a process with $0 myproc ===== [strict_errexit] ! { echo brace; } ===== brace ===== [strict_errexit] ! ( echo subshell ) ===== subshell ===== [strict_errexit] ! while false; do echo while; done ===== ===== [strict_errexit] ! case x in x) echo x;; esac ===== x ===== [strict_errexit] ! time echo hi ===== hi real 0.000 user 0.000 sys 0.000 ===== [strict_errexit] ! echo $(echo hi) ===== set -o errexit; shopt -s strict_errexit; ! echo $(echo hi) ^~~~ [ -c flag ]:1: fatal: Command subs not allowed here because status wouldn't be checked (strict_errexit). -------- CASE: unset_expr shopt -s unsafe_arith_eval ^~~~~ test/runtime-errors.sh:441: 'shopt' got invalid option 'unsafe_arith_eval' 1[1] ^ (source.ArgvWord word_spid:4):1: The [ operator doesn't apply to this expression unset -v 1[1] ^ [ -c flag ]:1: 'unset' Invalid unset expression unset -v 1+2 ^~~~~ [ -c flag ]:1: fatal: Invalid place to modify -------- 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 -------- CASE: no_such_command ZZZZZ ^~~~~ test/runtime-errors.sh:67: 'ZZZZZ' not found ZZZZZ ^~~~~ test/runtime-errors.sh:67: fatal: Exiting with status 127 (command in PID 5379) STATUS: 1 -------- CASE: no_such_command_commandsub echo $(ZZZZZ) ^~~~~ test/runtime-errors.sh:74: 'ZZZZZ' not found SHOULD NOT GET HERE STATUS: 1 -------- CASE: no_such_command_heredoc $(ZZZZZ) ^~~~~ test/runtime-errors.sh:85: 'ZZZZZ' not found one three SHOULD NOT GET HERE STATUS: 1 -------- CASE: failed_command false ^~~~~ test/runtime-errors.sh:93: fatal: Exiting with status 1 (command in PID 5386) STATUS: 1 -------- CASE: errexit_usage_error type -z ^~ test/runtime-errors.sh:102: 'type' doesn't accept flag -z type -z ^~~~ test/runtime-errors.sh:102: fatal: Exiting with status 2 (command in PID 5387) STATUS: 1 -------- CASE: errexit_subshell subshell ( echo subshell; exit 42; ) ^ test/runtime-errors.sh:109: fatal: Exiting with status 42 (subshell invoked from PID 5388) STATUS: 1 -------- CASE: errexit_pipeline 0 echo subshell | cat | exit 42 | wc -l ^ test/runtime-errors.sh:117: fatal: Exiting with status 42 (pipeline invoked from PID 5390) STATUS: 1 -------- CASE: errexit_dbracket [[ -n '' ]] ^~ test/runtime-errors.sh:122: fatal: Exiting with status 1 (PID 5395) 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 5396) STATUS: 1 -------- CASE: pipefail 0 false | wc -l ^~~~~ test/runtime-errors.sh:208: fatal: Exiting with status 1 (command in PID 5401) 0 false | wc -l ^~~~~ test/runtime-errors.sh:208: fatal: Exiting with status 1 (pipeline invoked from PID 5398) STATUS: 1 -------- CASE: pipefail_group 1 1 3 echo hi | { cat; sh -c 'exit 42'; } | wc ^ test/runtime-errors.sh:242: fatal: Exiting with status 42 (pipeline invoked from PID 5403) STATUS: 1 -------- CASE: pipefail_subshell 1 1 3 echo hi | (cat; sh -c 'exit 42') | wc ^ test/runtime-errors.sh:250: fatal: Exiting with status 42 (pipeline invoked from PID 5408) STATUS: 1 -------- CASE: pipefail_no_words seq 3 | wc -l | > /nonexistent ^ test/runtime-errors.sh:218: Can't open '/nonexistent': Permission denied seq 3 | wc -l | > /nonexistent ^ test/runtime-errors.sh:218: fatal: Exiting with status 1 (command in PID 5413) seq 3 | wc -l | > /nonexistent ^ test/runtime-errors.sh:218: fatal: Exiting with status 1 (pipeline invoked from PID 5413) STATUS: 1 -------- CASE: pipefail_func echo hi | cat | f42 | wc ^~~ test/runtime-errors.sh:233: fatal: Exiting with status 42 (command in PID 5419) 1 1 3 echo hi | cat | f42 | wc ^~~ test/runtime-errors.sh:233: fatal: Exiting with status 42 (pipeline invoked from PID 5416) STATUS: 1 -------- CASE: pipefail_while sh -c 'exit 42' ^~ test/runtime-errors.sh:262: fatal: Exiting with status 42 (command in PID 5424) 2 6 12 seq 3 | while true; do ^~~~~ test/runtime-errors.sh:258: fatal: Exiting with status 42 (pipeline invoked from PID 5422) STATUS: 1 -------- CASE: pipefail_multiple six { echo 'six'; sh -c 'exit 6'; } ^~ test/runtime-errors.sh:277: fatal: Exiting with status 6 (command in PID 5427) { echo 'six'; sh -c 'exit 6'; } ^ test/runtime-errors.sh:277: fatal: Exiting with status 6 (pipeline invoked from PID 5427) STATUS: 1 -------- CASE: core_process echo foo > not/a/file ^ test/runtime-errors.sh:290: Can't open 'not/a/file': No such file or directory echo foo > /etc/no-perms-for-this ^ test/runtime-errors.sh:291: Can't open '/etc/no-perms-for-this': Permission denied STATUS: 1 -------- CASE: osh_state HOME=(a b) ^~~~~ test/runtime-errors.sh:300: fatal: Only strings can be exported STATUS: 1 -------- CASE: nounset echo $x ^~ test/runtime-errors.sh:396: fatal: Undefined variable 'x' STATUS: 1 -------- CASE: bad_var_ref echo ${!name} ^~~~ test/runtime-errors.sh:403: fatal: Bad indirect expansion: 'bad var name' STATUS: 1 -------- CASE: nounset_arith echo $(( x )) ^~~~ test/runtime-errors.sh:412: fatal: Undefined variable 'x' STATUS: 1 -------- CASE: array_arith (( a++ )) # doesn't make sense ^ test/runtime-errors.sh:499: fatal: Expected a value convertible to integer, got value.MaybeStrArray STATUS: 1 -------- CASE: undef_arith (( undef[42]++ )) ^~ test/runtime-errors.sh:485: fatal: Can't use [] on value of type value.Str STATUS: 1 -------- CASE: undef_arith2 ['2'] STATUS: 1 -------- CASE: undef_assoc_array bar STATUS: 1 -------- CASE: unsafe_arith_eval shopt -s unsafe_arith_eval ^~~~~ test/runtime-errors.sh:433: 'shopt' got invalid option 'unsafe_arith_eval' echo $(( e2 )) ^~ test/runtime-errors.sh:437: fatal: Invalid integer constant 'e1 + 5' STATUS: 1 -------- CASE: string_to_int_arith 5 echo $(( x + 5 )) ^ test/runtime-errors.sh:455: fatal: Invalid integer constant 'ZZZ' STATUS: 1 -------- CASE: string_to_hex 1 SHOULD NOT GET HERE STATUS: 1 -------- CASE: string_to_octal 1 SHOULD NOT GET HERE STATUS: 1 -------- CASE: string_to_intbase 0 SHOULD NOT GET HERE STATUS: 1 -------- CASE: string_to_int_bool [[ a -eq 0 ]] ^ test/runtime-errors.sh:539: fatal: Invalid integer constant 'a' STATUS: 1 -------- CASE: string_as_array foo echo "${str[@]}" ^~ test/runtime-errors.sh:603: fatal: Can't index string with @ STATUS: 1 -------- CASE: array_assign_1 s[0]=x # can't assign value ^~ test/runtime-errors.sh:575: fatal: Can't assign to items in a string STATUS: 1 -------- CASE: array_assign_2 array[0]=x ^~~~~~ test/runtime-errors.sh:580: fatal: Can't assign to readonly array STATUS: 1 -------- CASE: readonly_assign x=2 ^~ test/runtime-errors.sh:585: fatal: Can't assign to readonly value 'x' STATUS: 1 -------- CASE: multiple_assign a=1 b=2 x=42 ^~ test/runtime-errors.sh:591: fatal: Can't assign to readonly value 'x' STATUS: 1 -------- CASE: multiple_assign_2 0 STATUS: 1 -------- CASE: patsub_bad_glob echo ${x//[^]} ^ test/runtime-errors.sh:525: fatal: Error matching regex '([^])': Unmatched [ or [^ STATUS: 1 -------- CASE: builtin_bracket [ -t xxx ] ^~~ test/runtime-errors.sh:614: (test) Invalid file descriptor 'xxx' [ -t '' ] ^ test/runtime-errors.sh:615: (test) Invalid file descriptor '' [ zz -eq 0 ] ^~ test/runtime-errors.sh:617: (test) Invalid integer constant 'zz' STATUS: 1 -------- CASE: builtin_builtin builtin ls ^~ test/runtime-errors.sh:625: 'ls' isn't a shell builtin STATUS: 1 -------- CASE: builtin_source source ^~~~~~ test/runtime-errors.sh:629: 'source' missing required argument source $bad ^~~~ test/runtime-errors.sh:632: source '/nonexistent/path' failed: No such file or directory STATUS: 1 -------- CASE: builtin_cd cd ^~ test/runtime-errors.sh:637: $HOME isn't defined cd ^~ test/runtime-errors.sh:643: $HOME should be a string cd - ^~ test/runtime-errors.sh:648: $OLDPWD isn't defined ( cd /nonexistent ^~~~~~~~~~~~ test/runtime-errors.sh:651: cd '/nonexistent': No such file or directory STATUS: 1 -------- CASE: builtin_pushd pushd /nonexistent ^~~~~~~~~~~~ test/runtime-errors.sh:656: pushd: '/nonexistent': No such file or directory STATUS: 1 -------- CASE: builtin_popd popd # empty dir stack ^~~~ test/runtime-errors.sh:660: 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:668: 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:676: Can't unset readonly variable 'a' unset -v x a ^ test/runtime-errors.sh:677: Can't unset readonly variable 'a' STATUS: 1 -------- CASE: builtin_alias_unalias alias zzz ^~~~~ test/runtime-errors.sh:681: No alias named 'zzz' unalias zzz ^~~~~~~ test/runtime-errors.sh:682: No alias named 'zzz' STATUS: 1 -------- CASE: builtin_help help zzz ^~~ test/runtime-errors.sh:686: no help topics match 'zzz' STATUS: 1 -------- CASE: builtin_trap trap ^~~~ test/runtime-errors.sh:690: 'trap' requires a code string trap EXIT ^~~~ test/runtime-errors.sh:691: 'trap' requires a signal or hook name trap zzz yyy ^~~ test/runtime-errors.sh:693: Invalid signal or hook 'yyy' STATUS: 1 -------- CASE: builtin_getopts getopts ^~~~~~~ test/runtime-errors.sh:697: 'getopts' requires an argspec getopts 'a:' ^~~~~~~ test/runtime-errors.sh:698: 'getopts' requires the name of a variable to set getopts 'a:' varname ^~~~~~~ test/runtime-errors.sh:702: getopts: option '-a' requires an argument. (getopts argv: -a) STATUS: 1 -------- CASE: builtin_wait wait 1234578 ^~~~~~~ test/runtime-errors.sh:740: 1234578 isn't a child of this shell STATUS: 1 -------- CASE: builtin_exec exec nonexistent-command 1 2 3 ^~~~~~~~~~~~~~~~~~~ test/runtime-errors.sh:744: exec: 'nonexistent-command' not found STATUS: 1 -------- CASE: strict_word_eval_warnings slice start negative -bc- slice length negative -- slice bad utf-8 [??? no location ???] warning: Invalid start of UTF-8 character -- length bad utf-8 echo ${#s} ^ test/runtime-errors.sh:771: warning: Invalid start of UTF-8 character -1 STATUS: 1 -------- CASE: strict_arith_warnings 1 echo $(( y + 1 )) ^ test/runtime-errors.sh:780: fatal: Invalid integer constant '-yy-' STATUS: 1 -------- CASE: strict_control_flow_warnings break ^~~~~ test/runtime-errors.sh:788: fatal: Unexpected 'break' (in function call) STATUS: 1 -------- CASE: control_flow_subshell 1 ( break; echo 'oops') ^~~~~ test/runtime-errors.sh:795: Loop and control flow can't be in different processes ( break; echo 'oops') ^ test/runtime-errors.sh:795: fatal: Exiting with status 1 (subshell invoked from PID 5478) STATUS: 1 -------- CASE: command_sub_errexit echo t=$(true) f=$(false) 3=$(exit 3) ^~ test/runtime-errors.sh:350: fatal: Command sub exited with status 1 (command.Simple) STATUS: 1 -------- CASE: process_sub_fail a b cat <(echo a; exit 2) <(echo b; exit 3) ^~ test/runtime-errors.sh:359: fatal: Exiting with status 3 (command in PID 5484) STATUS: 1 -------- CASE: bool_status if run --bool-status -- myproc; then ^~~ test/runtime-errors.sh:373: 'run' doesn't accept flag '--bool-status' no match STATUS: 1 -------- CASE: bool_status_simple if run --bool-status -- grep pat BAD; then ^~~ test/runtime-errors.sh:383: 'run' doesn't accept flag '--bool-status' no match STATUS: 1 -------- CASE: qsn_decode 'no closing quote ^ [ stdin ]:1: Expected closing single quote in QSN string 'foo' trailing data ^~~~~~~~~~~~~~ [ stdin ]:1: Unexpected data after closing quote '\x0' ^ [ stdin ]:1: Unexpected token in QSN string '\u{3bc' ^ [ stdin ]:1: Unexpected token in QSN string 'literal tab' ^ [ stdin ]:1: Unexpected token in QSN string STATUS: 1