-------- CASE: control_flow break ^~~~~ 'test/runtime-errors.sh':414: warning: Invalid control flow at top level continue ^~~~~~~~ 'test/runtime-errors.sh':415: 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':573: '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 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 STATUS: 1 -------- CASE: errexit_usage_error type -z ^~ 'test/runtime-errors.sh':102: 'type' doesn't accept flag -z STATUS: 1 -------- CASE: errexit_subshell subshell STATUS: 1 -------- CASE: errexit_pipeline 0 STATUS: 1 -------- CASE: errexit_dbracket STATUS: 1 -------- CASE: errexit_alias foo is a alias hi ls: cannot access '/nonexistent': No such file or directory STATUS: 1 -------- CASE: errexit_one_process zz ^~ [ -c flag ]:1: 'zz' not found [ -c flag ]:1: errexit PID 13695: Command failed with status 127 --------------------------- echo hi > "" ^ [ -c flag ]:1: Redirect filename can't be empty [ -c flag ]:1: errexit PID 13699: Command failed with status 1 --------------------------- shopt -s failglob; echo *.ZZZZ ^ [ -c flag ]:1: failglob: Pattern '*.ZZZZ' matched no files [ -c flag ]:1: errexit PID 13703: Command failed with status 1 --------------------------- cd /x ^~ [ -c flag ]:1: cd '/x': No such file or directory cd /x ^~ [ -c flag ]:1: errexit PID 13707: Command failed with status 1 --------------------------- ./README.md; echo hi ^~~~~~~~~~~ [ -c flag ]:1: Can't execute './README.md': Permission denied hi --------------------------- ./README.md; echo hi ^~~~~~~~~~~ [ -c flag ]:1: Can't execute './README.md': Permission denied ./README.md; echo hi ^~~~~~~~~~~ [ -c flag ]:1: errexit PID 13716: Command failed with status 126 ls: cannot access '/x': No such file or directory ls /x; echo $? ^~ [ -c flag ]:1: errexit PID 13721: Command failed with status 2 --------------------------- ls: cannot access '/x': No such file or directory declare cmd=ls; $cmd /x; echo $? ^~~~ [ -c flag ]:1: errexit PID 13726: Command failed with status 2 --------------------------- echo $undef ^~~~~~ [ -c flag ]:1: fatal: Undefined variable 'undef' --------------------------- Usage: grep [OPTION]... PATTERN [FILE]... Try 'grep --help' for more information. try --allow-status-01 grep ^~~~ [ -c flag ]:1: fatal: status 2 when --allow-status-01 --------------------------- ( ^ [ eval word at line 2 of [ -c flag ] ]:1: Unexpected EOF while parsing command status=2 ) ^ [ eval word at line 5 of [ -c flag ] ]:1: Invalid word while parsing command status=2 false ^~~~~ [ -c flag ]:9: errexit PID 13740: Command failed with status 1 --------------------------- [[ 0 -eq 1 ]] ^~ [ -c flag ]:1: errexit PID 13744: command.DBracket failed with status 1 --------------------------- (( 0 )) ^~ [ -c flag ]:1: errexit PID 13748: command.DParen failed with status 1 STATUS: 1 -------- CASE: errexit_multiple_processes echo t=$(true) f=$(false; true) ^~~~~ [ -c flag ]:1: errexit PID 13758: Command failed with status 1 [ -c flag ]:1: errexit PID 13753: Command Sub exited with status 1 --------------------------- ls | false | wc -l ^~~~~ [ -c flag ]:1: errexit PID 13764: Command failed with status 1 0 --------------------------- ls | { echo hi; ( exit 42 ); } | wc -l; echo ^ [ -c flag ]:1: errexit PID 13770: Subshell failed with status 42 1 ls | { echo hi; ( exit 42 ); } | wc -l; echo ^ [ -c flag ]:1: errexit PID 13765: Pipeline failed with status 42 --------------------------- { false; wc -l; } ^~~~~ [ -c flag ]:2: errexit PID 13773: Command failed with status 1 { echo one; ( exit 42 ); } |\ ^ [ -c flag ]:1: errexit PID 13777: Subshell failed with status 42 { false; wc -l; } ^ [ -c flag ]:2: errexit PID 13773: Pipeline failed with status 1 --------------------------- { ls; false; } \ ^~~~~ [ -c flag ]:1: errexit PID 13783: Command failed with status 1 72 { ls; false; } \ ^ [ -c flag ]:1: errexit PID 13779: Pipeline failed with status 1 --------------------------- { ls; ( false; true ); } | wc -l; echo hi ^~~~~ [ -c flag ]:1: errexit PID 13793: Command failed with status 1 { ls; ( false; true ); } | wc -l; echo hi ^ [ -c flag ]:1: errexit PID 13790: Subshell failed with status 1 72 { ls; ( false; true ); } | wc -l; echo hi ^ [ -c flag ]:1: errexit PID 13786: Pipeline failed with status 1 --------------------------- ls <(sort YY) <(zz); echo hi ^~ [ -c flag ]:1: 'zz' not found [ -c flag ]:1: errexit PID 13799: Command failed with status 127 sort: cannot read: YY: No such file or directory /dev/fd/3 /dev/fd/4 ls <(sort YY) <(zz); echo hi ^~ [ -c flag ]:1: errexit PID 13794: Command failed with status 127 --------------------------- zz <(sort YY) <(sort ZZ); echo hi ^~ [ -c flag ]:1: 'zz' not found sort: cannot read: YY: No such file or directory sort: cannot read: ZZ: No such file or directory [ -c flag ]:1: errexit PID 13801: Command failed with status 127 --------------------------- yy | zz ^~ yy | zz ^~ [ -c flag ]:1: 'yy' not found [ -c flag ]:1: 'zz' not found [ -c flag ]:1: errexit PID 13811: Command failed with status 127 [ -c flag ]:1: errexit PID 13807: Command failed with status 127 yy | zz ^~ [ -c flag ]:1: errexit PID 13807: Pipeline failed with status 127 --------------------------- echo $([[ 0 -eq 1 ]]) ^~ [ -c flag ]:1: errexit PID 13816: command.DBracket failed with status 1 [ -c flag ]:1: errexit PID 13812: Command Sub exited with status 1 --------------------------- var y = $([[ 0 -eq 1 ]]) ^~ [ -c flag ]:1: errexit PID 13822: command.DBracket failed with status 1 [ -c flag ]:1: errexit PID 13817: Command Sub exited with status 1 STATUS: 1 -------- CASE: command_sub_errexit STATUS: 1 -------- CASE: process_sub_fail a b STATUS: 1 -------- CASE: pipefail 0 0 STATUS: 1 -------- CASE: pipefail_group 1 1 3 STATUS: 1 -------- CASE: pipefail_subshell 1 1 3 STATUS: 1 -------- CASE: pipefail_no_words seq 3 | wc -l | > /nonexistent ^ 'test/runtime-errors.sh':350: Can't open '/nonexistent': Permission denied STATUS: 1 -------- CASE: pipefail_func 1 1 3 STATUS: 1 -------- CASE: pipefail_while 2 6 12 STATUS: 1 -------- CASE: pipefail_multiple six STATUS: 1 -------- CASE: core_process echo foo > not/a/file ^ 'test/runtime-errors.sh':422: Can't open 'not/a/file': No such file or directory echo foo > /etc/no-perms-for-this ^ 'test/runtime-errors.sh':423: Can't open '/etc/no-perms-for-this': Permission denied STATUS: 1 -------- CASE: osh_state HOME=(a b) ^~~~~ 'test/runtime-errors.sh':432: fatal: Only strings can be exported STATUS: 1 -------- CASE: nounset echo $x ^~ 'test/runtime-errors.sh':528: fatal: Undefined variable 'x' STATUS: 1 -------- CASE: bad_var_ref bad var name ^ [ var 'name' at line 535 of 'test/runtime-errors.sh' ]:1: Expected end of var ref echo ${!name} ^~~~ 'test/runtime-errors.sh':535: fatal: Invalid var ref STATUS: 1 -------- CASE: nounset_arith echo $(( x )) ^ 'test/runtime-errors.sh':544: fatal: Undefined variable 'x' STATUS: 1 -------- CASE: array_arith (( a++ )) # doesn't make sense ^ 'test/runtime-errors.sh':631: fatal: Expected a value convertible to integer, got value.MaybeStrArray STATUS: 1 -------- CASE: undef_arith (( undef[42]++ )) ^~ 'test/runtime-errors.sh':617: 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':565: 'shopt' got invalid option 'unsafe_arith_eval' echo $(( e2 )) ^~ 'test/runtime-errors.sh':569: fatal: Invalid integer constant 'e1 + 5' STATUS: 1 -------- CASE: string_to_int_arith 5 echo $(( x + 5 )) ^ 'test/runtime-errors.sh':587: 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':671: fatal: Invalid integer constant 'a' STATUS: 1 -------- CASE: string_as_array foo echo "${str[@]}" ^~ 'test/runtime-errors.sh':735: fatal: Can't index string with @ STATUS: 1 -------- CASE: array_assign_1 s[0]=x # can't assign value ^~ 'test/runtime-errors.sh':707: fatal: Can't assign to items in a string STATUS: 1 -------- CASE: array_assign_2 array[0]=x ^~~~~~ 'test/runtime-errors.sh':712: fatal: Can't assign to readonly array STATUS: 1 -------- CASE: readonly_assign x=2 ^~ 'test/runtime-errors.sh':717: fatal: Can't assign to readonly value 'x' STATUS: 1 -------- CASE: multiple_assign a=1 b=2 x=42 ^~ 'test/runtime-errors.sh':723: 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':657: fatal: Error matching regex '([^])': Unmatched [ or [^ STATUS: 1 -------- CASE: builtin_bracket [ -t xxx ] ^~~ 'test/runtime-errors.sh':746: (test) Invalid file descriptor 'xxx' [ -t '' ] ^ 'test/runtime-errors.sh':747: (test) Invalid file descriptor '' [ zz -eq 0 ] ^~ 'test/runtime-errors.sh':749: (test) Invalid integer constant 'zz' STATUS: 1 -------- CASE: builtin_builtin builtin ls ^~ 'test/runtime-errors.sh':757: 'ls' isn't a shell builtin STATUS: 1 -------- CASE: builtin_source source ^~~~~~ 'test/runtime-errors.sh':761: 'source' missing required argument source $bad ^~~~ 'test/runtime-errors.sh':764: source '/nonexistent/path' failed: No such file or directory STATUS: 1 -------- CASE: builtin_cd cd ^~ 'test/runtime-errors.sh':769: $HOME isn't defined cd ^~ 'test/runtime-errors.sh':775: $HOME should be a string cd - ^~ 'test/runtime-errors.sh':780: $OLDPWD isn't defined ( cd /nonexistent ^~~~~~~~~~~~ 'test/runtime-errors.sh':783: cd '/nonexistent': No such file or directory STATUS: 1 -------- CASE: builtin_pushd pushd /nonexistent ^~~~~~~~~~~~ 'test/runtime-errors.sh':788: pushd: '/nonexistent': No such file or directory STATUS: 1 -------- CASE: builtin_popd popd # empty dir stack ^~~~ 'test/runtime-errors.sh':792: 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':800: 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':808: Can't unset readonly variable 'a' unset -v x a ^ 'test/runtime-errors.sh':809: Can't unset readonly variable 'a' STATUS: 1 -------- CASE: builtin_alias_unalias alias zzz ^~~~~ 'test/runtime-errors.sh':813: No alias named 'zzz' unalias zzz ^~~~~~~ 'test/runtime-errors.sh':814: No alias named 'zzz' STATUS: 1 -------- CASE: builtin_help help zzz ^~~ 'test/runtime-errors.sh':818: no help topics match 'zzz' STATUS: 1 -------- CASE: builtin_trap trap ^~~~ 'test/runtime-errors.sh':822: 'trap' requires a code string trap EXIT ^~~~ 'test/runtime-errors.sh':823: 'trap' requires a signal or hook name trap zzz yyy ^~~ 'test/runtime-errors.sh':825: Invalid signal or hook 'yyy' STATUS: 1 -------- CASE: builtin_getopts getopts ^~~~~~~ 'test/runtime-errors.sh':829: 'getopts' requires an argspec getopts 'a:' ^~~~~~~ 'test/runtime-errors.sh':830: 'getopts' requires the name of a variable to set getopts 'a:' varname ^~~~~~~ 'test/runtime-errors.sh':834: getopts: option '-a' requires an argument. (getopts argv: -a) STATUS: 1 -------- CASE: builtin_wait wait 1234578 ^~~~~~~ 'test/runtime-errors.sh':872: 1234578 isn't a child of this shell STATUS: 1 -------- CASE: builtin_exec exec nonexistent-command 1 2 3 ^~~~~~~~~~~~~~~~~~~ 'test/runtime-errors.sh':876: 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':903: warning: Invalid start of UTF-8 character -1 STATUS: 1 -------- CASE: strict_arith_warnings 1 echo $(( y + 1 )) ^ 'test/runtime-errors.sh':912: fatal: Invalid integer constant '-yy-' STATUS: 1 -------- CASE: strict_control_flow_warnings break ^~~~~ 'test/runtime-errors.sh':920: fatal: Unexpected 'break' (in function call) STATUS: 1 -------- CASE: control_flow_subshell 1 ( break; echo 'oops') ^~~~~ 'test/runtime-errors.sh':927: Loop and control flow can't be in different processes STATUS: 1 -------- CASE: bool_status --- grep: BAD: No such file or directory grep pat BAD # exits with code 2 ^~~~ 'test/runtime-errors.sh':497: (original failure) if try --allow-status-01 -- myproc; then ^~~~~~ 'test/runtime-errors.sh':505: 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':515: 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