-------- CASE: control_flow break ^~~~~ test/runtime-errors.sh:177: warning: Invalid control flow at top level continue ^~~~~~~~ test/runtime-errors.sh:178: warning: Invalid control flow at top level SHOULD NOT GET HERE STATUS: 0 -------- CASE: no_such_command ZZZZZ ^~~~~ test/runtime-errors.sh:38: 'ZZZZZ' not found ZZZZZ ^~~~~ test/runtime-errors.sh:38: fatal: Exiting with status 127 (command in PID 19655) STATUS: 127 -------- CASE: no_such_command_commandsub echo $(ZZZZZ) ^~~~~ test/runtime-errors.sh:45: 'ZZZZZ' not found SHOULD NOT GET HERE STATUS: 0 -------- CASE: no_such_command_heredoc $(ZZZZZ) ^~~~~ test/runtime-errors.sh:57: 'ZZZZZ' not found one three SHOULD NOT GET HERE STATUS: 0 -------- CASE: failed_command false ^~~~~ test/runtime-errors.sh:65: fatal: Exiting with status 1 (command in PID 19662) STATUS: 1 -------- CASE: errexit_usage_error type -z ^~ test/runtime-errors.sh:74: 'type' doesn't accept flag '-z' type -z ^~~~ test/runtime-errors.sh:74: fatal: Exiting with status 2 (command in PID 19663) STATUS: 2 -------- CASE: errexit_subshell subshell ( echo subshell; exit 42; ) ^ test/runtime-errors.sh:81: fatal: Exiting with status 42 (subshell invoked from PID 19664) STATUS: 42 -------- CASE: errexit_dbracket [[ -n '' ]] ^~ test/runtime-errors.sh:86: fatal: Exiting with status 1 (PID 19666) 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 19667) STATUS: 2 -------- CASE: cannot_disable_errexit _func() { set +o errexit; echo _func; } ^~~ test/runtime-errors.sh:102: fatal: Can't set 'errexit' in a context where it's disabled (if, !, && ||, while/until conditions) STATUS: 0 -------- CASE: pipefail 0 false | wc -l ^~~~~ test/runtime-errors.sh:115: fatal: Exiting with status 1 (command in PID 19673) 0 false | wc -l ^ test/runtime-errors.sh:115: fatal: Exiting with status 1 (pipeline invoked from PID 19670) STATUS: 1 -------- CASE: pipefail_group echo hi | { cat; sh -c 'exit 42'; } | wc ^~ test/runtime-errors.sh:137: fatal: Exiting with status 42 (command in PID 19677) 1 1 3 echo hi | { cat; sh -c 'exit 42'; } | wc ^ test/runtime-errors.sh:137: fatal: Exiting with status 42 (pipeline invoked from PID 19675) STATUS: 42 -------- CASE: pipefail_subshell echo hi | (cat; sh -c 'exit 42') | wc ^~ test/runtime-errors.sh:145: fatal: Exiting with status 42 (command in PID 19684) echo hi | (cat; sh -c 'exit 42') | wc ^ test/runtime-errors.sh:145: fatal: Exiting with status 42 (subshell invoked from PID 19683) 1 1 3 echo hi | (cat; sh -c 'exit 42') | wc ^ test/runtime-errors.sh:145: fatal: Exiting with status 42 (pipeline invoked from PID 19681) STATUS: 42 -------- CASE: pipefail_func echo hi | f | wc ^ test/runtime-errors.sh:128: fatal: Exiting with status 42 (command in PID 19690) 1 1 3 echo hi | f | wc ^ test/runtime-errors.sh:128: fatal: Exiting with status 42 (pipeline invoked from PID 19688) STATUS: 42 -------- CASE: pipefail_while sh -c 'exit 42' ^~ test/runtime-errors.sh:157: fatal: Exiting with status 42 (command in PID 19695) 2 6 12 seq 3 | while true; do ^ test/runtime-errors.sh:153: fatal: Exiting with status 42 (pipeline invoked from PID 19693) STATUS: 42 -------- CASE: pipefail_multiple six { echo 'six'; sh -c 'exit 6'; } { echo 'five'; sh -c 'exit 5'; } | { echo 'four'; sh -c 'exit 4'; } | ^ ~ ^ ~ ^~ test/runtime-errors.sh:172: fatal: Exiting with status 6 (command in PID 19698) test/runtime-errors.sh:171: fatal: Exiting with status 5 (command in PID 19700)test/runtime-errors.sh:170: fatal: Exiting with status 4 (command in PID 19699) { echo 'four'; sh -c 'exit 4'; } | ^ test/runtime-errors.sh:170: fatal: Exiting with status 6 (pipeline invoked from PID 19698) STATUS: 6 -------- CASE: core_process echo foo > not/a/file ^ test/runtime-errors.sh:185: Can't open 'not/a/file': No such file or directory echo foo > /etc/no-perms-for-this ^ test/runtime-errors.sh:186: Can't open '/etc/no-perms-for-this': Permission denied echo hi 1>&3 ^~~ test/runtime-errors.sh:187: 3: Bad file descriptor STATUS: 1 -------- CASE: osh_state HOME=(a b) ^~~~~ test/runtime-errors.sh:193: fatal: Can't export array STATUS: 1 -------- CASE: nounset echo $x ^~ test/runtime-errors.sh:244: fatal: Undefined variable 'x' STATUS: 1 -------- CASE: bad_var_ref echo ${!name} ^~~~ test/runtime-errors.sh:251: fatal: Bad indirect expansion: 'bad var name' STATUS: 1 -------- CASE: nounset_arith echo $(( x )) ^~~~ test/runtime-errors.sh:260: fatal: Undefined variable 'x' STATUS: 1 -------- CASE: divzero echo $(( 1 / 0 )) ^ test/runtime-errors.sh:266: fatal: Divide by zero STATUS: 1 -------- CASE: divzero_var echo $(( 1 / zero )) ^~~~ test/runtime-errors.sh:273: fatal: Divide by zero (name) STATUS: 1 -------- CASE: array_arith (( a++ )) # doesn't make sense ^~ test/runtime-errors.sh:340: fatal: Can't use assignment like ++ or += on arrays STATUS: 1 -------- CASE: undef_arith (( undef++ )) # doesn't make sense ^~~~~ test/runtime-errors.sh:323: fatal: Undefined value in arithmetic context (0 if shopt -u strict-arith) STATUS: 1 -------- CASE: undef_arith2 (( a[42]++ )) ^~ test/runtime-errors.sh:333: fatal: Invalid integer constant '' STATUS: 1 -------- CASE: undef_assoc_array bar STATUS: 0 -------- CASE: string_to_int_arith echo $(( x + 5 )) ^ test/runtime-errors.sh:292: fatal: Invalid integer constant 'ZZZ' STATUS: 1 -------- CASE: string_to_hex echo $(( 0xGG + 1 )) ^ test/runtime-errors.sh:303: fatal: Invalid hex constant '0xGG' STATUS: 1 -------- CASE: string_to_octal echo $(( 018 + 1 )) ^~~ test/runtime-errors.sh:310: fatal: Invalid octal constant '018' STATUS: 1 -------- CASE: string_to_intbase echo $(( 16#GG )) ^~ test/runtime-errors.sh:317: fatal: Digits 'GG' out of range for base 16 STATUS: 1 -------- CASE: string_to_int_bool [[ a -eq 0 ]] ^ test/runtime-errors.sh:376: fatal: Invalid integer constant 'a' STATUS: 1 -------- CASE: string_as_array foo echo "${str[@]}" ^~ test/runtime-errors.sh:444: fatal: Can't index string with @: (value.Str s:foo) STATUS: 1 -------- CASE: array_assign_1 s[0]=x # can't assign value ^~ test/runtime-errors.sh:416: fatal: Entries in value of type value__Str can't be assigned to STATUS: 1 -------- CASE: array_assign_2 array[0]=x ^~~~~~ test/runtime-errors.sh:421: fatal: Can't assign to readonly value STATUS: 1 -------- CASE: readonly_assign x=2 ^~ test/runtime-errors.sh:426: fatal: Can't assign to readonly value 'x' STATUS: 1 -------- CASE: multiple_assign a=1 b=2 x=42 ^~ test/runtime-errors.sh:432: fatal: Can't assign to readonly value 'x' STATUS: 1 -------- CASE: multiple_assign_2 1 STATUS: 0 -------- CASE: patsub_bad_glob echo ${x//[^]} ^ test/runtime-errors.sh:366: fatal: Error matching regex '([^])': Invalid regex syntax (func_regex_first_group_match) STATUS: 1 -------- CASE: builtin_bracket [ -t xxx ] ^~~ test/runtime-errors.sh:453: (test) Invalid file descriptor 'xxx' STATUS: 2 -------- CASE: builtin_builtin builtin ls ^~ test/runtime-errors.sh:458: 'ls' isn't a shell builtin STATUS: 1 -------- CASE: builtin_source source ^~~~~~ test/runtime-errors.sh:462: 'source' missing required argument source $bad ^~~~ test/runtime-errors.sh:465: source '/nonexistent/path' failed: No such file or directory STATUS: 1 -------- CASE: builtin_cd cd ^~ test/runtime-errors.sh:470: $HOME isn't defined HOME=(a b) ^~~~~ test/runtime-errors.sh:475: fatal: Can't export array cd - ^~ test/runtime-errors.sh:481: OLDPWD not set ( cd /nonexistent ^~~~~~~~~~~~ test/runtime-errors.sh:484: cd '/nonexistent': No such file or directory STATUS: 1 -------- CASE: builtin_pushd pushd /nonexistent ^~~~~~~~~~~~ test/runtime-errors.sh:489: pushd: '/nonexistent': No such file or directory STATUS: 1 -------- CASE: builtin_popd popd # empty dir stack ^~~~ test/runtime-errors.sh:493: 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:501: 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:509: Can't unset readonly variable 'a' unset -v x a ^ test/runtime-errors.sh:510: Can't unset readonly variable 'a' STATUS: 1 -------- CASE: builtin_alias_unalias alias zzz ^~~ test/runtime-errors.sh:514: No alias named 'zzz' unalias zzz ^~~ test/runtime-errors.sh:515: No alias named 'zzz' STATUS: 1 -------- CASE: builtin_help help zzz ^~~ test/runtime-errors.sh:519: No help topics match 'zzz' STATUS: 1 -------- CASE: builtin_trap trap ^~~~ test/runtime-errors.sh:523: 'trap' requires a code string trap EXIT ^~~~ test/runtime-errors.sh:524: 'trap' requires a signal or hook name trap zzz yyy ^~~ test/runtime-errors.sh:526: Invalid signal or hook 'yyy' STATUS: 1 -------- CASE: builtin_getopts getopts ^~~~~~~ test/runtime-errors.sh:530: 'getopts' requires an argspec getopts 'a:' ^~~~~~~ test/runtime-errors.sh:531: 'getopts' requires the name of a variable to set getopts 'a:' varname ^~~~~~~ test/runtime-errors.sh:535: getopts: option '-a' requires an argument. (getopts argv: -a) STATUS: 0 -------- CASE: builtin_wait wait 1234578 ^~~~~~~ test/runtime-errors.sh:549: 1234578 isn't a child of this shell STATUS: 127 -------- CASE: builtin_exec exec nonexistent-command 1 2 3 ^~~~~~~~~~~~~~~~~~~ test/runtime-errors.sh:553: exec: 'nonexistent-command' not found STATUS: 127 -------- CASE: strict_word_eval_warnings slice start negative echo -${s: -2}- ^~ test/runtime-errors.sh:566: warning: The start index of a string slice can't be negative: -2 -- slice length negative echo -${s: 1: -2}- ^~ test/runtime-errors.sh:570: 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 [??? no location ???] warning: Invalid start of UTF-8 character -1 STATUS: 0 -------- CASE: strict_arith_warnings echo $(( x + 1 )) ^ test/runtime-errors.sh:585: fatal: Invalid integer constant 'xx' STATUS: 1 -------- CASE: strict_control_flow_warnings break ^~~~~ test/runtime-errors.sh:597: fatal: Unexpected 'break' (in function call) STATUS: 1 -------- CASE: control_flow_subshell 1 ( break; echo 'oops') ^~~~~ test/runtime-errors.sh:604: Loop and control flow can't be in different processes ( break; echo 'oops') ^ test/runtime-errors.sh:604: fatal: Exiting with status 1 (subshell invoked from PID 19751) STATUS: 1