-------- CASE: control_flow break ^~~~~ 'test/runtime-errors.sh':287: warning: Invalid control flow at top level continue ^~~~~~~~ 'test/runtime-errors.sh':288: 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 'try'. ===== [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 'try'. ===== [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 'try'. ===== [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 'try'. ===== [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 'try'. ===== [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 'try'. ===== [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 'try'. ===== [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 'try'. ===== [strict_errexit] shopt -s oil:basic proc p { echo p } if p { echo hi } ===== if p { echo hi } ^~ [ -c flag ]:3: errexit was disabled for this construct if p { echo hi } ^ [ -c flag ]:3: fatal: Can't run a proc while errexit is disabled. Use 'try' or wrap it in a process with $0 myproc -------- 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 'try' 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) ===== hi -------- CASE: unset_expr shopt -s unsafe_arith_eval ^~~~~ 'test/runtime-errors.sh':446: 'shopt' got invalid option 'unsafe_arith_eval' 1[1] ^ [ dynamic place word at line 1 of [ -c flag ] ]:1: The [ operator doesn't apply to this expression unset -v 1[1] ^ [ -c flag ]:1: 'unset' got invalid place 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 12136) 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 12161) 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 12165) STATUS: 1 -------- CASE: errexit_subshell subshell ( echo subshell; exit 42; ) ^ 'test/runtime-errors.sh':109: fatal: Exiting with status 42 (subshell invoked from PID 12168) 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 12170) STATUS: 1 -------- CASE: errexit_dbracket [[ -n '' ]] ^~ 'test/runtime-errors.sh':122: fatal: Exiting with status 1 (PID 12176) 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 12177) STATUS: 1 -------- CASE: pipefail 0 false | wc -l ^~~~~ 'test/runtime-errors.sh':213: fatal: Exiting with status 1 (command in PID 12182) 0 false | wc -l ^~~~~ 'test/runtime-errors.sh':213: fatal: Exiting with status 1 (pipeline invoked from PID 12179) STATUS: 1 -------- CASE: pipefail_group 1 1 3 echo hi | { cat; sh -c 'exit 42'; } | wc ^ 'test/runtime-errors.sh':247: fatal: Exiting with status 42 (pipeline invoked from PID 12184) STATUS: 1 -------- CASE: pipefail_subshell 1 1 3 echo hi | (cat; sh -c 'exit 42') | wc ^ 'test/runtime-errors.sh':255: fatal: Exiting with status 42 (pipeline invoked from PID 12191) STATUS: 1 -------- CASE: pipefail_no_words seq 3 | wc -l | > /nonexistent ^ 'test/runtime-errors.sh':223: Can't open '/nonexistent': Permission denied seq 3 | wc -l | > /nonexistent ^ 'test/runtime-errors.sh':223: fatal: Exiting with status 1 (command in PID 12197) seq 3 | wc -l | > /nonexistent ^ 'test/runtime-errors.sh':223: fatal: Exiting with status 1 (pipeline invoked from PID 12197) STATUS: 1 -------- CASE: pipefail_func echo hi | cat | f42 | wc ^~~ 'test/runtime-errors.sh':238: fatal: Exiting with status 42 (command in PID 12209) 1 1 3 echo hi | cat | f42 | wc ^~~ 'test/runtime-errors.sh':238: fatal: Exiting with status 42 (pipeline invoked from PID 12202) STATUS: 1 -------- CASE: pipefail_while sh -c 'exit 42' ^~ 'test/runtime-errors.sh':267: fatal: Exiting with status 42 (command in PID 12217) 2 6 12 seq 3 | while true; do ^~~~~ 'test/runtime-errors.sh':263: fatal: Exiting with status 42 (pipeline invoked from PID 12215) STATUS: 1 -------- CASE: pipefail_multiple six { echo 'six'; sh -c 'exit 6'; } ^~ 'test/runtime-errors.sh':282: fatal: Exiting with status 6 (command in PID 12223) { echo 'six'; sh -c 'exit 6'; } ^ 'test/runtime-errors.sh':282: fatal: Exiting with status 6 (pipeline invoked from PID 12223) STATUS: 1 -------- CASE: core_process echo foo > not/a/file ^ 'test/runtime-errors.sh':295: Can't open 'not/a/file': No such file or directory echo foo > /etc/no-perms-for-this ^ 'test/runtime-errors.sh':296: Can't open '/etc/no-perms-for-this': Permission denied STATUS: 1 -------- CASE: osh_state HOME=(a b) ^~~~~ 'test/runtime-errors.sh':305: fatal: Only strings can be exported STATUS: 1 -------- CASE: nounset echo $x ^~ 'test/runtime-errors.sh':401: fatal: Undefined variable 'x' STATUS: 1 -------- CASE: bad_var_ref bad var name ^ [ var ? ]:1: Expected end of var ref echo ${!name} ^~~~ 'test/runtime-errors.sh':408: fatal: Invalid var ref STATUS: 1 -------- CASE: nounset_arith echo $(( x )) ^~~~ 'test/runtime-errors.sh':417: fatal: Undefined variable 'x' STATUS: 1 -------- CASE: array_arith (( a++ )) # doesn't make sense ^ 'test/runtime-errors.sh':504: fatal: Expected a value convertible to integer, got value.MaybeStrArray STATUS: 1 -------- CASE: undef_arith (( undef[42]++ )) ^~ 'test/runtime-errors.sh':490: 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':438: 'shopt' got invalid option 'unsafe_arith_eval' echo $(( e2 )) ^~ 'test/runtime-errors.sh':442: fatal: Invalid integer constant 'e1 + 5' STATUS: 1 -------- CASE: string_to_int_arith 5 echo $(( x + 5 )) ^ 'test/runtime-errors.sh':460: 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':544: fatal: Invalid integer constant 'a' STATUS: 1 -------- CASE: string_as_array foo echo "${str[@]}" ^~ 'test/runtime-errors.sh':608: fatal: Can't index string with @ STATUS: 1 -------- CASE: array_assign_1 s[0]=x # can't assign value ^~ 'test/runtime-errors.sh':580: fatal: Can't assign to items in a string STATUS: 1 -------- CASE: array_assign_2 array[0]=x ^~~~~~ 'test/runtime-errors.sh':585: fatal: Can't assign to readonly array STATUS: 1 -------- CASE: readonly_assign x=2 ^~ 'test/runtime-errors.sh':590: fatal: Can't assign to readonly value 'x' STATUS: 1 -------- CASE: multiple_assign a=1 b=2 x=42 ^~ 'test/runtime-errors.sh':596: 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':530: fatal: Error matching regex '([^])': Unmatched [ or [^ STATUS: 1 -------- CASE: builtin_bracket [ -t xxx ] ^~~ 'test/runtime-errors.sh':619: (test) Invalid file descriptor 'xxx' [ -t '' ] ^ 'test/runtime-errors.sh':620: (test) Invalid file descriptor '' [ zz -eq 0 ] ^~ 'test/runtime-errors.sh':622: (test) Invalid integer constant 'zz' STATUS: 1 -------- CASE: builtin_builtin builtin ls ^~ 'test/runtime-errors.sh':630: 'ls' isn't a shell builtin STATUS: 1 -------- CASE: builtin_source source ^~~~~~ 'test/runtime-errors.sh':634: 'source' missing required argument source $bad ^~~~ 'test/runtime-errors.sh':637: source '/nonexistent/path' failed: No such file or directory STATUS: 1 -------- CASE: builtin_cd cd ^~ 'test/runtime-errors.sh':642: $HOME isn't defined cd ^~ 'test/runtime-errors.sh':648: $HOME should be a string cd - ^~ 'test/runtime-errors.sh':653: $OLDPWD isn't defined ( cd /nonexistent ^~~~~~~~~~~~ 'test/runtime-errors.sh':656: cd '/nonexistent': No such file or directory STATUS: 1 -------- CASE: builtin_pushd pushd /nonexistent ^~~~~~~~~~~~ 'test/runtime-errors.sh':661: pushd: '/nonexistent': No such file or directory STATUS: 1 -------- CASE: builtin_popd popd # empty dir stack ^~~~ 'test/runtime-errors.sh':665: 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':673: 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':681: Can't unset readonly variable 'a' unset -v x a ^ 'test/runtime-errors.sh':682: Can't unset readonly variable 'a' STATUS: 1 -------- CASE: builtin_alias_unalias alias zzz ^~~~~ 'test/runtime-errors.sh':686: No alias named 'zzz' unalias zzz ^~~~~~~ 'test/runtime-errors.sh':687: No alias named 'zzz' STATUS: 1 -------- CASE: builtin_help help zzz ^~~ 'test/runtime-errors.sh':691: no help topics match 'zzz' STATUS: 1 -------- CASE: builtin_trap trap ^~~~ 'test/runtime-errors.sh':695: 'trap' requires a code string trap EXIT ^~~~ 'test/runtime-errors.sh':696: 'trap' requires a signal or hook name trap zzz yyy ^~~ 'test/runtime-errors.sh':698: Invalid signal or hook 'yyy' STATUS: 1 -------- CASE: builtin_getopts getopts ^~~~~~~ 'test/runtime-errors.sh':702: 'getopts' requires an argspec getopts 'a:' ^~~~~~~ 'test/runtime-errors.sh':703: 'getopts' requires the name of a variable to set getopts 'a:' varname ^~~~~~~ 'test/runtime-errors.sh':707: getopts: option '-a' requires an argument. (getopts argv: -a) STATUS: 1 -------- CASE: builtin_wait wait 1234578 ^~~~~~~ 'test/runtime-errors.sh':745: 1234578 isn't a child of this shell STATUS: 1 -------- CASE: builtin_exec exec nonexistent-command 1 2 3 ^~~~~~~~~~~~~~~~~~~ 'test/runtime-errors.sh':749: 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':776: warning: Invalid start of UTF-8 character -1 STATUS: 1 -------- CASE: strict_arith_warnings 1 echo $(( y + 1 )) ^ 'test/runtime-errors.sh':785: fatal: Invalid integer constant '-yy-' STATUS: 1 -------- CASE: strict_control_flow_warnings break ^~~~~ 'test/runtime-errors.sh':793: fatal: Unexpected 'break' (in function call) STATUS: 1 -------- CASE: control_flow_subshell 1 ( break; echo 'oops') ^~~~~ 'test/runtime-errors.sh':800: Loop and control flow can't be in different processes ( break; echo 'oops') ^ 'test/runtime-errors.sh':800: fatal: Exiting with status 1 (subshell invoked from PID 12314) STATUS: 1 -------- CASE: command_sub_errexit echo t=$(true) f=$(false) 3=$(exit 3) ^~ 'test/runtime-errors.sh':355: 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':364: fatal: Exiting with status 3 (command in PID 12330) STATUS: 1 -------- CASE: bool_status --- grep: BAD: No such file or directory grep pat BAD # exits with code 2 ^~~~ 'test/runtime-errors.sh':370: (original failure) if try --allow-status-01 -- myproc; then ^~~~~~ 'test/runtime-errors.sh':378: fatal: fatal: status 2 when --allow-status-01 STATUS: 1 -------- CASE: bool_status_simple grep: BAD: No such file or directory if try --allow-status-01 -- grep pat BAD; then ^~~~ 'test/runtime-errors.sh':388: fatal: fatal: status 2 when --allow-status-01 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