-------- 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: Can't execute 'ZZZZZ': No such file or directory ZZZZZ ^~~~~ test/runtime-errors.sh:38: fatal: Exiting with status 127 (command in PID 1296) STATUS: 127 -------- CASE: no_such_command_commandsub echo $(ZZZZZ) ^~~~~ test/runtime-errors.sh:45: Can't execute 'ZZZZZ': No such file or directory SHOULD NOT GET HERE STATUS: 0 -------- CASE: no_such_command_heredoc $(ZZZZZ) ^~~~~ test/runtime-errors.sh:57: Can't execute 'ZZZZZ': No such file or directory 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 1306) 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 1307) STATUS: 2 -------- CASE: errexit_subshell subshell ( echo subshell; exit 42; ) ^ test/runtime-errors.sh:81: fatal: Exiting with status 42 (subshell invoked from PID 1308) STATUS: 42 -------- CASE: errexit_dbracket [[ -n '' ]] ^~ test/runtime-errors.sh:86: fatal: Exiting with status 1 (PID 1310) 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 1311) 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 1317) 0 false | wc -l ^ test/runtime-errors.sh:115: fatal: Exiting with status 1 (pipeline invoked from PID 1314) 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 1321) 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 1319) 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 1328) echo hi | (cat; sh -c 'exit 42') | wc ^ test/runtime-errors.sh:145: fatal: Exiting with status 42 (subshell invoked from PID 1327) 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 1325) STATUS: 42 -------- CASE: pipefail_func echo hi | f | wc ^ test/runtime-errors.sh:128: fatal: Exiting with status 42 (command in PID 1334) 1 1 3 echo hi | f | wc ^ test/runtime-errors.sh:128: fatal: Exiting with status 42 (pipeline invoked from PID 1332) STATUS: 42 -------- CASE: pipefail_while sh -c 'exit 42' ^~ test/runtime-errors.sh:157: fatal: Exiting with status 42 (command in PID 1339) 2 6 12 seq 3 | while true; do ^ test/runtime-errors.sh:153: fatal: Exiting with status 42 (pipeline invoked from PID 1337) STATUS: 42 -------- CASE: pipefail_multiple six { echo 'six'; sh -c 'exit 6'; } ^~ { echo 'four'; sh -c 'exit 4'; } | test/runtime-errors.sh:172: fatal: Exiting with status 6 (command in PID 1342) ^~ test/runtime-errors.sh:170: fatal: Exiting with status 4 (command in PID 1343) { echo 'five'; sh -c 'exit 5'; } | ^~ test/runtime-errors.sh:171: fatal: Exiting with status 5 (command in PID 1344) { echo 'four'; sh -c 'exit 4'; } | ^ test/runtime-errors.sh:170: fatal: Exiting with status 6 (pipeline invoked from PID 1342) 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: warning: Coercing undefined value to 0 in arithmetic context (( undef[42]++ )) ^~ test/runtime-errors.sh:326: fatal: Can't assign to characters of string 'undef' STATUS: 1 -------- CASE: undef_arith2 [??? no location ???] warning: Invalid integer constant '' ['2'] STATUS: 0 -------- CASE: undef_assoc_array bar STATUS: 0 -------- CASE: string_to_int_arith echo $(( x + 5 )) ^ test/runtime-errors.sh:292: warning: Invalid integer constant 'ZZZ' 5 echo $(( x + 5 )) ^ test/runtime-errors.sh:296: fatal: Invalid integer constant 'ZZZ' STATUS: 1 -------- CASE: string_to_hex echo $(( 0xGG + 1 )) ^ test/runtime-errors.sh:303: warning: Invalid hex constant '0xGG' 1 SHOULD NOT GET HERE STATUS: 0 -------- CASE: string_to_octal echo $(( 018 + 1 )) ^~~ test/runtime-errors.sh:310: warning: Invalid octal constant '018' 1 SHOULD NOT GET HERE STATUS: 0 -------- CASE: string_to_intbase echo $(( 16#GG )) ^~ test/runtime-errors.sh:317: warning: Digits 'GG' out of range for base 16 0 SHOULD NOT GET HERE STATUS: 0 -------- CASE: string_to_int_bool [[ a -eq 0 ]] ^ test/runtime-errors.sh:376: warning: Invalid integer constant 'a' [[ a -eq 0 ]] ^ test/runtime-errors.sh:380: fatal: Invalid integer constant 'a' STATUS: 1 -------- CASE: array_assign_1 s[0]=x # can't assign value ^~ test/runtime-errors.sh:415: 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:420: fatal: Can't assign to readonly value STATUS: 1 -------- CASE: readonly_assign x=2 ^~ test/runtime-errors.sh:425: fatal: Can't assign to readonly value 'x' STATUS: 1 -------- CASE: multiple_assign a=1 b=2 x=42 ^~ test/runtime-errors.sh:431: 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:446: (test) Invalid file descriptor 'xxx' STATUS: 2 -------- CASE: builtin_builtin builtin ls ^~ test/runtime-errors.sh:451: 'ls' isn't a shell builtin STATUS: 1 -------- CASE: builtin_source source ^~~~~~ test/runtime-errors.sh:455: 'source' missing required argument source $bad ^~~~ test/runtime-errors.sh:458: source '/nonexistent/path' failed: No such file or directory STATUS: 1 -------- CASE: builtin_cd cd ^~ test/runtime-errors.sh:463: $HOME isn't defined HOME=(a b) ^~~~~ test/runtime-errors.sh:468: fatal: Can't export array cd - ^~ test/runtime-errors.sh:474: OLDPWD not set ( cd /nonexistent ^~~~~~~~~~~~ test/runtime-errors.sh:477: cd '/nonexistent': No such file or directory STATUS: 1 -------- CASE: builtin_pushd pushd /nonexistent ^~~~~~~~~~~~ test/runtime-errors.sh:482: pushd: '/nonexistent': No such file or directory STATUS: 1 -------- CASE: builtin_popd popd # empty dir stack ^~~~ test/runtime-errors.sh:486: 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:494: 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:502: Can't unset readonly variable 'a' unset -v x a ^ test/runtime-errors.sh:503: Can't unset readonly variable 'a' STATUS: 1 -------- CASE: builtin_alias_unalias alias zzz ^~~ test/runtime-errors.sh:507: No alias named 'zzz' unalias zzz ^~~ test/runtime-errors.sh:508: No alias named 'zzz' STATUS: 1 -------- CASE: builtin_help help zzz ^~~ test/runtime-errors.sh:512: No help topics match 'zzz' STATUS: 1 -------- CASE: builtin_trap trap ^~~~ test/runtime-errors.sh:516: 'trap' requires a code string trap EXIT ^~~~ test/runtime-errors.sh:517: 'trap' requires a signal or hook name trap zzz yyy ^~~ test/runtime-errors.sh:519: Invalid signal or hook 'yyy' STATUS: 1 -------- CASE: builtin_getopts getopts ^~~~~~~ test/runtime-errors.sh:523: 'getopts' requires an argspec Traceback (most recent call last): File "/home/andy/git/oilshell/oil/bin/oil.py", line 859, in main(sys.argv) File "/home/andy/git/oilshell/oil/bin/oil.py", line 827, in main sys.exit(AppBundleMain(argv)) File "/home/andy/git/oilshell/oil/bin/oil.py", line 797, in AppBundleMain status = ShellMain('osh', argv0, main_argv, login_shell) File "/home/andy/git/oilshell/oil/bin/oil.py", line 610, in ShellMain status = main_loop.Batch(ex, c_parser, arena, nodes_out=nodes_out) File "/home/andy/git/oilshell/oil/core/main_loop.py", line 162, in Batch is_control_flow, is_fatal = ex.ExecuteAndCatch(node) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1188, in ExecuteAndCatch status = self._Execute(node, fork_external=fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1136, in _Execute status, check_errexit = self._Dispatch(node, fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 671, in _Dispatch status = self.RunSimpleCommand(arg_vec, fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 532, in RunSimpleCommand status = self._RunFunc(func_node, argv[1:]) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1377, in _RunFunc status = self._Execute(func_node.body) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1136, in _Execute status, check_errexit = self._Dispatch(node, fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 862, in _Dispatch status = self._ExecuteList(node.children) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1157, in _ExecuteList status = self._Execute(child) # last status wins File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1136, in _Execute status, check_errexit = self._Dispatch(node, fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 963, in _Dispatch status = self._Execute(node.body) # last one wins File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1136, in _Execute status, check_errexit = self._Dispatch(node, fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1007, in _Dispatch status = self._ExecuteList(node.children) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1157, in _ExecuteList status = self._Execute(child) # last status wins File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1136, in _Execute status, check_errexit = self._Dispatch(node, fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 671, in _Dispatch status = self.RunSimpleCommand(arg_vec, fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 532, in RunSimpleCommand status = self._RunFunc(func_node, argv[1:]) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1377, in _RunFunc status = self._Execute(func_node.body) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1136, in _Execute status, check_errexit = self._Dispatch(node, fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 862, in _Dispatch status = self._ExecuteList(node.children) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1157, in _ExecuteList status = self._Execute(child) # last status wins File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1136, in _Execute status, check_errexit = self._Dispatch(node, fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 719, in _Dispatch status = p.Run(self.waiter) File "/home/andy/git/oilshell/oil/core/process.py", line 703, in Run self.Start() File "/home/andy/git/oilshell/oil/core/process.py", line 675, in Start self.thunk.Run() File "/home/andy/git/oilshell/oil/core/process.py", line 554, in Run self.ex.ExecuteAndCatch(self.node, fork_external=False) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1188, in ExecuteAndCatch status = self._Execute(node, fork_external=fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1136, in _Execute status, check_errexit = self._Dispatch(node, fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 862, in _Dispatch status = self._ExecuteList(node.children) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1157, in _ExecuteList status = self._Execute(child) # last status wins File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1136, in _Execute status, check_errexit = self._Dispatch(node, fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 671, in _Dispatch status = self.RunSimpleCommand(arg_vec, fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 532, in RunSimpleCommand status = self._RunFunc(func_node, argv[1:]) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1377, in _RunFunc status = self._Execute(func_node.body) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1136, in _Execute status, check_errexit = self._Dispatch(node, fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 862, in _Dispatch status = self._ExecuteList(node.children) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1157, in _ExecuteList status = self._Execute(child) # last status wins File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1136, in _Execute status, check_errexit = self._Dispatch(node, fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 671, in _Dispatch status = self.RunSimpleCommand(arg_vec, fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 538, in RunSimpleCommand return self._RunBuiltin(builtin_id, arg_vec, fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 324, in _RunBuiltin status = self._RunBuiltinAndRaise(builtin_id, arg_vec, fork_external) File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 276, in _RunBuiltinAndRaise status = builtin_func(arg_vec) File "/home/andy/git/oilshell/oil/osh/builtin.py", line 1495, in __call__ 'requires the name of a variable to set') File "/home/andy/git/oilshell/oil/frontend/args.py", line 128, in ReadRequired2 spid = self.spids[self.i] IndexError: list index out of range STATUS: 1 -------- CASE: builtin_wait wait 1234578 ^~~~~~~ test/runtime-errors.sh:542: 1234578 isn't a child of this shell STATUS: 127 -------- CASE: strict_word_eval_warnings slice start negative echo -${s: -2}- ^~ test/runtime-errors.sh:554: warning: The start index of a string slice can't be negative: -2 -- slice length negative echo -${s: 1: -2}- ^~ test/runtime-errors.sh:558: 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:573: warning: Invalid integer constant 'xx' 1 echo $(( y + 1 )) ^ test/runtime-errors.sh:577: warning: Invalid integer constant '-yy-' 1 [[ $y -eq 0 ]] ^~ test/runtime-errors.sh:579: warning: Invalid integer constant '-yy-' done STATUS: 0 -------- CASE: strict_control_flow_warnings break ^~~~~ test/runtime-errors.sh:585: fatal: Unexpected 'break' (in function call) STATUS: 1 -------- CASE: control_flow_subshell 1 ( break; echo 'oops') ^~~~~ test/runtime-errors.sh:592: Loop and control flow can't be in different processes ( break; echo 'oops') ^ test/runtime-errors.sh:592: fatal: Exiting with status 1 (subshell invoked from PID 1394) STATUS: 1