-------- CASE: control_flow break ^~~~~ test/runtime-errors.sh:249: warning: Invalid control flow at top level continue ^~~~~~~~ test/runtime-errors.sh:250: 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 26269) 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:76: 'ZZZZZ' not found one three SHOULD NOT GET HERE STATUS: 0 -------- CASE: failed_command false ^~~~~ test/runtime-errors.sh:84: fatal: Exiting with status 1 (command in PID 26276) STATUS: 1 -------- CASE: errexit_usage_error type -z ^~ test/runtime-errors.sh:93: 'type' doesn't accept flag -z type -z ^~~~ test/runtime-errors.sh:93: fatal: Exiting with status 2 (command in PID 26277) STATUS: 2 -------- CASE: errexit_subshell subshell ( echo subshell; exit 42; ) ^ test/runtime-errors.sh:100: fatal: Exiting with status 42 (subshell invoked from PID 26278) STATUS: 42 -------- CASE: errexit_dbracket [[ -n '' ]] ^~ test/runtime-errors.sh:105: fatal: Exiting with status 1 (PID 26280) 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 26281) STATUS: 2 -------- CASE: strict_errexit_1 ===== [strict_errexit] ! { echo 1; echo 2; } ===== set -o errexit; shopt -s strict_errexit; ! { echo 1; echo 2; } ^ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (BraceGroup) ===== [strict_errexit] { echo 1; echo 2; } && true ===== set -o errexit; shopt -s strict_errexit; { echo 1; echo 2; } && true ^~ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (BraceGroup) ===== [strict_errexit] { echo 1; echo 2; } || true ===== set -o errexit; shopt -s strict_errexit; { echo 1; echo 2; } || true ^~ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (BraceGroup) ===== [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: errexit is disabled here, but strict_errexit disallows it with a compound command (BraceGroup) ===== [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: errexit is disabled here, but strict_errexit disallows it with a compound command (BraceGroup) ===== [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: errexit is disabled here, but strict_errexit disallows it with a compound command (BraceGroup) ===== [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: errexit is disabled here, but strict_errexit disallows it with a compound command (BraceGroup) ===== [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: errexit is disabled here, but strict_errexit disallows it with a compound command (BraceGroup) ===== [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: errexit is disabled here, but strict_errexit disallows it with a compound command (BraceGroup) STATUS: 0 -------- CASE: strict_errexit_2 ===== [strict_errexit] if ls | wc -l; then echo Pipeline; fi ===== set -o errexit; shopt -s strict_errexit; if ls | wc -l; then echo Pipeline; fi ^~ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (Pipeline) ===== [strict_errexit] if echo a && echo b; then echo AndOr; fi ===== set -o errexit; shopt -s strict_errexit; if echo a && echo b; then echo AndOr; fi ^~ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (AndOr) ===== [strict_errexit] ! for x in a; do echo $x; done ===== set -o errexit; shopt -s strict_errexit; ! for x in a; do echo $x; done ^ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (DoGroup) ===== [strict_errexit] _func() { echo; }; ! _func ===== set -o errexit; shopt -s strict_errexit; _func() { echo; }; ! _func ^~~~~ [ -c flag ]:1: fatal: can't disable errexit running a function. Maybe wrap the function in a process with the at-splice pattern. ===== [strict_errexit] ! { echo brace; } ===== set -o errexit; shopt -s strict_errexit; ! { echo brace; } ^ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (BraceGroup) ===== [strict_errexit] ! ( echo subshell ) ===== set -o errexit; shopt -s strict_errexit; ! ( echo subshell ) ^ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (Subshell) ===== [strict_errexit] ! while false; do echo while; done ===== set -o errexit; shopt -s strict_errexit; ! while false; do echo while; done ^ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (WhileUntil) ===== [strict_errexit] ! if true; then false; fi ===== set -o errexit; shopt -s strict_errexit; ! if true; then false; fi ^ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (If) ===== [strict_errexit] ! case x in x) echo x;; esac ===== set -o errexit; shopt -s strict_errexit; ! case x in x) echo x;; esac ^ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (Case) ===== [strict_errexit] ! time echo hi ===== set -o errexit; shopt -s strict_errexit; ! time echo hi ^ [ -c flag ]:1: fatal: errexit is disabled here, but strict_errexit disallows it with a compound command (TimeBlock) STATUS: 0 -------- CASE: pipefail 0 false | wc -l ^~~~~ test/runtime-errors.sh:187: fatal: Exiting with status 1 (command in PID 26524) 0 false | wc -l ^ test/runtime-errors.sh:187: fatal: Exiting with status 1 (pipeline invoked from PID 26521) STATUS: 1 -------- CASE: pipefail_group echo hi | { cat; sh -c 'exit 42'; } | wc ^~ test/runtime-errors.sh:209: fatal: Exiting with status 42 (command in PID 26528) 1 1 3 echo hi | { cat; sh -c 'exit 42'; } | wc ^ test/runtime-errors.sh:209: fatal: Exiting with status 42 (pipeline invoked from PID 26526) STATUS: 42 -------- CASE: pipefail_subshell echo hi | (cat; sh -c 'exit 42') | wc ^~ test/runtime-errors.sh:217: fatal: Exiting with status 42 (command in PID 26536) echo hi | (cat; sh -c 'exit 42') | wc ^ test/runtime-errors.sh:217: fatal: Exiting with status 42 (subshell invoked from PID 26535) 1 1 3 echo hi | (cat; sh -c 'exit 42') | wc ^ test/runtime-errors.sh:217: fatal: Exiting with status 42 (pipeline invoked from PID 26533) STATUS: 42 -------- CASE: pipefail_func echo hi | f | wc ^ test/runtime-errors.sh:200: fatal: Exiting with status 42 (command in PID 26543) 1 1 3 echo hi | f | wc ^ test/runtime-errors.sh:200: fatal: Exiting with status 42 (pipeline invoked from PID 26541) STATUS: 42 -------- CASE: pipefail_while sh -c 'exit 42' ^~ test/runtime-errors.sh:229: fatal: Exiting with status 42 (command in PID 26548) 2 6 12 seq 3 | while true; do ^ test/runtime-errors.sh:225: fatal: Exiting with status 42 (pipeline invoked from PID 26546) STATUS: 42 -------- CASE: pipefail_multiple six { echo 'four'; sh -c 'exit 4'; } | ^~ { echo 'six'; sh -c 'exit 6'; } test/runtime-errors.sh:242: fatal: Exiting with status 4 (command in PID 26556) ^~ test/runtime-errors.sh:244: fatal: Exiting with status 6 (command in PID 26555) { echo 'five'; sh -c 'exit 5'; } | ^~ test/runtime-errors.sh:243: fatal: Exiting with status 5 (command in PID 26557) { echo 'four'; sh -c 'exit 4'; } | ^ test/runtime-errors.sh:242: fatal: Exiting with status 6 (pipeline invoked from PID 26555) STATUS: 6 -------- CASE: core_process echo foo > not/a/file ^ test/runtime-errors.sh:257: Can't open 'not/a/file': No such file or directory echo foo > /etc/no-perms-for-this ^ test/runtime-errors.sh:258: Can't open '/etc/no-perms-for-this': Permission denied echo hi 1>&3 ^~~ test/runtime-errors.sh:259: 3: Bad file descriptor STATUS: 1 -------- CASE: osh_state HOME=(a b) ^~~~~ test/runtime-errors.sh:265: fatal: Can't export array STATUS: 1 -------- CASE: nounset echo $x ^~ test/runtime-errors.sh:316: fatal: Undefined variable 'x' STATUS: 1 -------- CASE: bad_var_ref echo ${!name} ^~~~ test/runtime-errors.sh:323: fatal: Bad indirect expansion: 'bad var name' STATUS: 1 -------- CASE: nounset_arith echo $(( x )) ^~~~ test/runtime-errors.sh:332: fatal: Undefined variable 'x' STATUS: 1 -------- CASE: divzero echo $(( 1 / 0 )) ^ test/runtime-errors.sh:338: fatal: Divide by zero STATUS: 1 -------- CASE: divzero_var echo $(( 1 / zero )) ^~~~ test/runtime-errors.sh:345: fatal: Divide by zero (name) STATUS: 1 -------- CASE: array_arith (( a++ )) # doesn't make sense ^~ test/runtime-errors.sh:412: fatal: Can't use assignment like ++ or += on arrays STATUS: 1 -------- CASE: undef_arith (( undef++ )) # doesn't make sense ^~~~~ test/runtime-errors.sh:395: fatal: Undefined value in arithmetic context (0 if shopt -u strict-arith) STATUS: 1 -------- CASE: undef_arith2 (( a[42]++ )) ^~ test/runtime-errors.sh:405: 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:364: fatal: Invalid integer constant 'ZZZ' STATUS: 1 -------- CASE: string_to_hex echo $(( 0xGG + 1 )) ^ test/runtime-errors.sh:375: fatal: Invalid hex constant '0xGG' STATUS: 1 -------- CASE: string_to_octal echo $(( 018 + 1 )) ^~~ test/runtime-errors.sh:382: fatal: Invalid octal constant '018' STATUS: 1 -------- CASE: string_to_intbase echo $(( 16#GG )) ^~ test/runtime-errors.sh:389: fatal: Digits 'GG' out of range for base 16 STATUS: 1 -------- CASE: string_to_int_bool [[ a -eq 0 ]] ^ test/runtime-errors.sh:448: fatal: Invalid integer constant 'a' STATUS: 1 -------- CASE: string_as_array foo echo "${str[@]}" ^~ test/runtime-errors.sh:516: 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:488: 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:493: fatal: Can't assign to readonly array STATUS: 1 -------- CASE: readonly_assign x=2 ^~ test/runtime-errors.sh:498: fatal: Can't assign to readonly value 'x' STATUS: 1 -------- CASE: multiple_assign a=1 b=2 x=42 ^~ test/runtime-errors.sh:504: fatal: Can't assign to readonly value 'x' STATUS: 1 -------- CASE: multiple_assign_2 local x=1 y=$(( x )) ^ test/runtime-errors.sh:509: fatal: Undefined value in arithmetic context (0 if shopt -u strict-arith) STATUS: 1 -------- CASE: patsub_bad_glob echo ${x//[^]} ^ test/runtime-errors.sh:438: fatal: Error matching regex '([^])': Invalid regex syntax (func_regex_first_group_match) STATUS: 1 -------- CASE: builtin_bracket [ -t xxx ] ^~~ test/runtime-errors.sh:525: (test) Invalid file descriptor 'xxx' STATUS: 2 -------- CASE: builtin_builtin builtin ls ^~ test/runtime-errors.sh:530: %r isn't a shell builtin STATUS: 1 -------- CASE: builtin_source source ^~~~~~ test/runtime-errors.sh:534: 'source' missing required argument source $bad ^~~~ test/runtime-errors.sh:537: source '/nonexistent/path' failed: No such file or directory STATUS: 1 -------- CASE: builtin_cd cd ^~ test/runtime-errors.sh:542: $HOME isn't defined cd ^~ test/runtime-errors.sh:548: $HOME shouldn't be an array cd - ^~ test/runtime-errors.sh:553: $OLDPWD not set ( cd /nonexistent ^~~~~~~~~~~~ test/runtime-errors.sh:556: cd '/nonexistent': No such file or directory STATUS: 1 -------- CASE: builtin_pushd pushd /nonexistent ^~~~~~~~~~~~ test/runtime-errors.sh:561: pushd: '/nonexistent': No such file or directory STATUS: 1 -------- CASE: builtin_popd popd # empty dir stack ^~~~ test/runtime-errors.sh:565: 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:573: 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:581: Can't unset readonly variable 'a' unset -v x a ^ test/runtime-errors.sh:582: Can't unset readonly variable 'a' STATUS: 1 -------- CASE: builtin_alias_unalias alias zzz ^~~ test/runtime-errors.sh:586: No alias named 'zzz' unalias zzz ^~~ test/runtime-errors.sh:587: No alias named 'zzz' STATUS: 1 -------- CASE: builtin_help help zzz ^~~ test/runtime-errors.sh:591: No help topics match 'zzz' STATUS: 1 -------- CASE: builtin_trap trap ^~~~ test/runtime-errors.sh:595: 'trap' requires a code string trap EXIT ^~~~ test/runtime-errors.sh:596: 'trap' requires a signal or hook name trap zzz yyy ^~~ test/runtime-errors.sh:598: Invalid signal or hook 'yyy' STATUS: 1 -------- CASE: builtin_getopts getopts ^~~~~~~ test/runtime-errors.sh:602: 'getopts' requires an argspec getopts 'a:' ^~~~~~~ test/runtime-errors.sh:603: 'getopts' requires the name of a variable to set getopts 'a:' varname ^~~~~~~ test/runtime-errors.sh:607: getopts: option '-a' requires an argument. (getopts argv: -a) STATUS: 0 -------- CASE: builtin_wait wait 1234578 ^~~~~~~ test/runtime-errors.sh:621: 1234578 isn't a child of this shell STATUS: 127 -------- CASE: builtin_exec exec nonexistent-command 1 2 3 ^~~~~~~~~~~~~~~~~~~ test/runtime-errors.sh:625: exec: 'nonexistent-command' not found STATUS: 127 -------- CASE: strict_word_eval_warnings slice start negative echo -${s: -2}- ^~ test/runtime-errors.sh:638: warning: The start index of a string slice can't be negative: -2 -- slice length negative echo -${s: 1: -2}- ^~ test/runtime-errors.sh:642: 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:657: fatal: Invalid integer constant 'xx' STATUS: 1 -------- CASE: strict_control_flow_warnings break ^~~~~ test/runtime-errors.sh:669: fatal: Unexpected 'break' (in function call) STATUS: 1 -------- CASE: control_flow_subshell 1 ( break; echo 'oops') ^~~~~ test/runtime-errors.sh:676: Loop and control flow can't be in different processes ( break; echo 'oops') ^ test/runtime-errors.sh:676: fatal: Exiting with status 1 (subshell invoked from PID 26608) STATUS: 1