-------- CASE: control_flow break ^~~~~ test/runtime-errors.sh:272: warning: Invalid control flow at top level continue ^~~~~~~~ test/runtime-errors.sh:273: 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 13762) 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:75: 'ZZZZZ' not found one three SHOULD NOT GET HERE STATUS: 0 -------- CASE: failed_command false ^~~~~ test/runtime-errors.sh:83: fatal: Exiting with status 1 (command in PID 13769) STATUS: 1 -------- CASE: errexit_usage_error type -z ^~ test/runtime-errors.sh:92: 'type' doesn't accept flag -z type -z ^~~~ test/runtime-errors.sh:92: fatal: Exiting with status 2 (command in PID 13770) STATUS: 2 -------- CASE: errexit_subshell subshell ( echo subshell; exit 42; ) ^ test/runtime-errors.sh:99: fatal: Exiting with status 42 (subshell invoked from PID 13771) STATUS: 42 -------- CASE: errexit_pipeline 0 echo subshell | cat | exit 42 | wc -l ^ test/runtime-errors.sh:107: fatal: Exiting with status 42 (pipeline invoked from PID 13773) STATUS: 42 -------- CASE: errexit_dbracket [[ -n '' ]] ^~ test/runtime-errors.sh:112: fatal: Exiting with status 1 (PID 13778) 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 13779) STATUS: 2 -------- 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'. STATUS: 0 -------- CASE: strict_errexit_2 ===== [strict_errexit] if ls | wc -l; then echo Pipeline; fi ===== 86 Pipeline Expected status 1, got 0 STATUS: 1 -------- CASE: pipefail 0 false | wc -l ^~~~~ test/runtime-errors.sh:198: fatal: Exiting with status 1 (command in PID 13828) 0 false | wc -l ^~~~~ test/runtime-errors.sh:198: fatal: Exiting with status 1 (pipeline invoked from PID 13825) STATUS: 1 -------- CASE: pipefail_group 1 1 3 echo hi | { cat; sh -c 'exit 42'; } | wc ^ test/runtime-errors.sh:232: fatal: Exiting with status 42 (pipeline invoked from PID 13830) STATUS: 42 -------- CASE: pipefail_subshell 1 1 3 echo hi | (cat; sh -c 'exit 42') | wc ^ test/runtime-errors.sh:240: fatal: Exiting with status 42 (pipeline invoked from PID 13835) STATUS: 42 -------- CASE: pipefail_no_words seq 3 | wc -l | > /nonexistent ^ test/runtime-errors.sh:208: Can't open '/nonexistent': Permission denied seq 3 | wc -l | > /nonexistent ^ test/runtime-errors.sh:208: fatal: Exiting with status 1 (command in PID 13840) seq 3 | wc -l | > /nonexistent ^ test/runtime-errors.sh:208: fatal: Exiting with status 1 (pipeline invoked from PID 13840) STATUS: 1 -------- CASE: pipefail_func echo hi | cat | f42 | wc ^~~ test/runtime-errors.sh:223: fatal: Exiting with status 42 (command in PID 13846) 1 1 3 echo hi | cat | f42 | wc ^~~ test/runtime-errors.sh:223: fatal: Exiting with status 42 (pipeline invoked from PID 13843) STATUS: 42 -------- CASE: pipefail_while sh -c 'exit 42' ^~ test/runtime-errors.sh:252: fatal: Exiting with status 42 (command in PID 13851) 2 6 12 seq 3 | while true; do ^~~~~ test/runtime-errors.sh:248: fatal: Exiting with status 42 (pipeline invoked from PID 13849) STATUS: 42 -------- CASE: pipefail_multiple six { echo 'six'; sh -c 'exit 6'; } ^~ test/runtime-errors.sh:267: fatal: Exiting with status 6 (command in PID 13854) { echo 'six'; sh -c 'exit 6'; } ^ test/runtime-errors.sh:267: fatal: Exiting with status 6 (pipeline invoked from PID 13854) STATUS: 6 -------- CASE: core_process echo foo > not/a/file ^ test/runtime-errors.sh:280: Can't open 'not/a/file': No such file or directory echo foo > /etc/no-perms-for-this ^ test/runtime-errors.sh:281: Can't open '/etc/no-perms-for-this': Permission denied echo hi 1>&3 ^~~ test/runtime-errors.sh:282: 3: Bad file descriptor STATUS: 1 -------- CASE: osh_state HOME=(a b) ^~~~~ test/runtime-errors.sh:288: fatal: Only strings can be exported STATUS: 1 -------- CASE: nounset echo $x ^~ test/runtime-errors.sh:384: fatal: Undefined variable 'x' STATUS: 1 -------- CASE: bad_var_ref echo ${!name} ^~~~ test/runtime-errors.sh:391: fatal: Bad indirect expansion: 'bad var name' STATUS: 1 -------- CASE: nounset_arith echo $(( x )) ^~~~ test/runtime-errors.sh:400: 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:486: fatal: Expected a value convertible to integer, got value.MaybeStrArray STATUS: 1 -------- CASE: undef_arith (( undef[42]++ )) ^~ test/runtime-errors.sh:472: fatal: Can't use [] on value of type value.Str STATUS: 1 -------- CASE: undef_arith2 ['2'] STATUS: 0 -------- CASE: undef_assoc_array bar STATUS: 0 -------- CASE: unsafe_arith_eval shopt -s unsafe_arith_eval ^~~~~ test/runtime-errors.sh:421: 'shopt' got invalid option 'unsafe_arith_eval' echo $(( e2 )) ^~ test/runtime-errors.sh:425: fatal: Invalid integer constant 'e1 + 5' STATUS: 1 -------- CASE: unset_expr shopt -s unsafe_arith_eval ^~~~~ test/runtime-errors.sh:429: '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 Expected status 1, got 2 STATUS: 1 -------- CASE: string_to_int_arith 5 echo $(( x + 5 )) ^ test/runtime-errors.sh:442: 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:526: fatal: Invalid integer constant 'a' STATUS: 1 -------- CASE: string_as_array foo echo "${str[@]}" ^~ test/runtime-errors.sh:590: fatal: Can't index string with @ STATUS: 1 -------- CASE: array_assign_1 s[0]=x # can't assign value ^~ test/runtime-errors.sh:562: fatal: Can't assign to items in a string STATUS: 1 -------- CASE: array_assign_2 array[0]=x ^~~~~~ test/runtime-errors.sh:567: fatal: Can't assign to readonly array STATUS: 1 -------- CASE: readonly_assign x=2 ^~ test/runtime-errors.sh:572: fatal: Can't assign to readonly value 'x' STATUS: 1 -------- CASE: multiple_assign a=1 b=2 x=42 ^~ test/runtime-errors.sh:578: 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:512: fatal: Error matching regex '([^])': Unmatched [ or [^ STATUS: 1 -------- CASE: builtin_bracket [ -t xxx ] ^~~ test/runtime-errors.sh:601: (test) Invalid file descriptor 'xxx' [ -t '' ] ^ test/runtime-errors.sh:602: (test) Invalid file descriptor '' [ zz -eq 0 ] ^~ test/runtime-errors.sh:604: (test) Invalid integer constant 'zz' STATUS: 2 -------- CASE: builtin_builtin builtin ls ^~ test/runtime-errors.sh:612: 'ls' isn't a shell builtin STATUS: 1 -------- CASE: builtin_source source ^~~~~~ test/runtime-errors.sh:616: 'source' missing required argument source $bad ^~~~ test/runtime-errors.sh:619: source '/nonexistent/path' failed: No such file or directory STATUS: 1 -------- CASE: builtin_cd cd ^~ test/runtime-errors.sh:624: $HOME isn't defined cd ^~ test/runtime-errors.sh:630: $HOME should be a string cd - ^~ test/runtime-errors.sh:635: $OLDPWD isn't defined ( cd /nonexistent ^~~~~~~~~~~~ test/runtime-errors.sh:638: cd '/nonexistent': No such file or directory STATUS: 1 -------- CASE: builtin_pushd pushd /nonexistent ^~~~~~~~~~~~ test/runtime-errors.sh:643: pushd: '/nonexistent': No such file or directory STATUS: 1 -------- CASE: builtin_popd popd # empty dir stack ^~~~ test/runtime-errors.sh:647: 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:655: 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:663: Can't unset readonly variable 'a' unset -v x a ^ test/runtime-errors.sh:664: Can't unset readonly variable 'a' STATUS: 1 -------- CASE: builtin_alias_unalias alias zzz ^~~~~ test/runtime-errors.sh:668: No alias named 'zzz' unalias zzz ^~~~~~~ test/runtime-errors.sh:669: No alias named 'zzz' STATUS: 1 -------- CASE: builtin_help help zzz ^~~ test/runtime-errors.sh:673: no help topics match 'zzz' STATUS: 1 -------- CASE: builtin_trap trap ^~~~ test/runtime-errors.sh:677: 'trap' requires a code string trap EXIT ^~~~ test/runtime-errors.sh:678: 'trap' requires a signal or hook name trap zzz yyy ^~~ test/runtime-errors.sh:680: Invalid signal or hook 'yyy' STATUS: 1 -------- CASE: builtin_getopts getopts ^~~~~~~ test/runtime-errors.sh:684: 'getopts' requires an argspec getopts 'a:' ^~~~~~~ test/runtime-errors.sh:685: 'getopts' requires the name of a variable to set getopts 'a:' varname ^~~~~~~ test/runtime-errors.sh:689: getopts: option '-a' requires an argument. (getopts argv: -a) STATUS: 0 -------- CASE: builtin_wait wait 1234578 ^~~~~~~ test/runtime-errors.sh:727: 1234578 isn't a child of this shell STATUS: 127 -------- CASE: builtin_exec exec nonexistent-command 1 2 3 ^~~~~~~~~~~~~~~~~~~ test/runtime-errors.sh:731: exec: 'nonexistent-command' not found STATUS: 127 -------- 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:758: warning: Invalid start of UTF-8 character -1 STATUS: 0 -------- CASE: strict_arith_warnings 1 echo $(( y + 1 )) ^ test/runtime-errors.sh:767: fatal: Invalid integer constant '-yy-' STATUS: 1 -------- CASE: strict_control_flow_warnings break ^~~~~ test/runtime-errors.sh:775: fatal: Unexpected 'break' (in function call) STATUS: 1 -------- CASE: control_flow_subshell 1 ( break; echo 'oops') ^~~~~ test/runtime-errors.sh:782: Loop and control flow can't be in different processes ( break; echo 'oops') ^ test/runtime-errors.sh:782: fatal: Exiting with status 1 (subshell invoked from PID 13943) STATUS: 1 -------- CASE: command_sub_errexit echo t=$(true) f=$(false) 3=$(exit 3) ^~ test/runtime-errors.sh:338: 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:347: fatal: Exiting with status 3 (command in PID 13949) STATUS: 3 -------- CASE: bool_status if run --bool-status -- myproc; then ^~~ test/runtime-errors.sh:361: 'run' doesn't accept flag '--bool-status' no match STATUS: 0 -------- CASE: bool_status_simple if run --bool-status -- grep pat BAD; then ^~~ test/runtime-errors.sh:371: 'run' doesn't accept flag '--bool-status' no match STATUS: 0 -------- 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: 0