ninja: no work to do. /// /// Runtime errors - Unquoted test functions /// ===== TEST function: unquoted-ambiguous_redirect ===== echo foo > "$@" ^ test/runtime-errors.sh:524: Can't redirect to zero files ambiguous redirect not fatal unless errexit echo foo > "$@" ^ test/runtime-errors.sh:528: Can't redirect to zero files ----- STATUS: 0 ===== TEST function: unquoted-ambiguous_redirect_context ===== echo $(echo hi > "$@") ^ test/runtime-errors.sh:541: Can't redirect to zero files ambiguous is NOT FATAL in command sub foo=$(echo hi > "$@") ^ test/runtime-errors.sh:545: Can't redirect to zero files ambiguous is NOT FATAL in assignment in command sub echo $(echo hi > "$@") ^ test/runtime-errors.sh:553: Can't redirect to zero files ambiguous is NOT FATAL in command sub, even if errexit But when the command sub is in an assignment, it is fatal foo=$(echo hi > "$@") ^ test/runtime-errors.sh:560: Can't redirect to zero files ----- STATUS: 0 ===== TEST function: unquoted-array_arith ===== 2 2 ----- STATUS: 0 ===== TEST function: unquoted-array_assign_1 ===== s[0]=x # can't assign value ^~ test/runtime-errors.sh:796: fatal: Can't assign to items in a string ----- STATUS: 0 ===== TEST function: unquoted-array_assign_2 ===== ===== CASE: -c readonly -a array=(1 2 3); array[0]=x ===== readonly -a array=(1 2 3); array[0]=x ^~~~~~ [ -c flag ]:1: fatal: Can't assign to readonly array ===== CASE: -c readonly -a array=(1 2 3); export array ===== readonly -a array=(1 2 3); export array ^~~~~ [ -c flag ]:1: fatal: Only strings can be exported ----- STATUS: 0 ===== TEST function: unquoted-bad_file_descriptor ===== F_GETFD fd 7: Bad file descriptor test/runtime-errors.sh:566: I/O error applying redirect: Bad file descriptor ----- STATUS: 0 ===== TEST function: unquoted-bad_var_ref ===== bad var name ^ [ contents of var 'name' at line 627 of test/runtime-errors.sh ]:1: Expected end of var ref expression echo ${!name} ^~~~ test/runtime-errors.sh:627: fatal: Invalid var ref expression ----- STATUS: 0 ===== TEST function: unquoted-bool_status ===== if try --allow-status-01 -- myproc; then ^~~~~~~~~~~~~~~~~ test/runtime-errors.sh:597: 'try' got invalid flag '--allow-status-01' no match ----- STATUS: 0 ===== TEST function: unquoted-bool_status_simple ===== if try --allow-status-01 -- grep pat BAD; then ^~~~~~~~~~~~~~~~~ test/runtime-errors.sh:607: 'try' got invalid flag '--allow-status-01' no match ----- STATUS: 0 ===== TEST function: unquoted-builtin_alias_unalias ===== alias zzz ^~~~~ test/runtime-errors.sh:907: No alias named 'zzz' unalias zzz ^~~~~~~ test/runtime-errors.sh:908: No alias named 'zzz' ----- STATUS: 0 ===== TEST function: unquoted-builtin_bracket ===== [ -t xxx ] ^~~ test/runtime-errors.sh:840: (test) Invalid file descriptor 'xxx' [ -t '' ] ^ test/runtime-errors.sh:841: (test) Invalid file descriptor '' [ zz -eq 0 ] ^~ test/runtime-errors.sh:843: (test) Invalid integer constant 'zz' ----- STATUS: 0 ===== TEST function: unquoted-builtin_builtin ===== builtin ls ^~ test/runtime-errors.sh:851: 'ls' isn't a shell builtin ----- STATUS: 0 ===== TEST function: unquoted-builtin_cd ===== cd ^~ test/runtime-errors.sh:863: $HOME isn't defined cd ^~ test/runtime-errors.sh:869: $HOME should be a string cd - ^~ test/runtime-errors.sh:874: $OLDPWD isn't defined ( cd /nonexistent ^ test/runtime-errors.sh:877: cd '/nonexistent': No such file or directory ----- STATUS: 0 ===== TEST function: unquoted-builtin_exec ===== exec nonexistent-command 1 2 3 ^~~~~~~~~~~~~~~~~~~ test/runtime-errors.sh:970: fatal: exec: 'nonexistent-command' not found ----- STATUS: 0 ===== TEST function: unquoted-builtin_getopts ===== getopts ^~~~~~~ test/runtime-errors.sh:923: 'getopts' requires an argspec getopts 'a:' ^~~~~~~ test/runtime-errors.sh:924: 'getopts' requires the name of a variable to set getopts 'a:' varname ^~~~~~~ test/runtime-errors.sh:928: getopts: option '-a' requires an argument. (getopts argv: -a) ----- STATUS: 0 ===== TEST function: unquoted-builtin_help ===== help zzz ^~~ test/runtime-errors.sh:912: no help topics match 'zzz' ----- STATUS: 0 ===== TEST function: unquoted-builtin_popd ===== popd # empty dir stack ^~~~ test/runtime-errors.sh:886: popd: directory stack is empty ~/oil/_tmp/runtime-error-popd ~/oil / ~/oil/_tmp/runtime-error-popd ~/oil popd ^~~~ test/runtime-errors.sh:894: popd: '/home/uke/oil/_tmp/runtime-error-popd': No such file or directory ----- STATUS: 0 ===== TEST function: unquoted-builtin_pushd ===== pushd /nonexistent ^ test/runtime-errors.sh:882: pushd: '/nonexistent': No such file or directory ----- STATUS: 0 ===== TEST function: unquoted-builtin_source ===== source ^~~~~~ test/runtime-errors.sh:855: 'source' missing required argument source $bad ^~~~ test/runtime-errors.sh:858: source '/nonexistent/path' failed: No such file or directory ----- STATUS: 0 ===== TEST function: unquoted-builtin_trap ===== trap ^~~~ test/runtime-errors.sh:916: 'trap' requires a code string trap EXIT ^~~~ test/runtime-errors.sh:917: 'trap' requires a signal or hook name trap zzz yyy ^~~ test/runtime-errors.sh:919: Invalid signal or hook 'yyy' ----- STATUS: 0 ===== TEST function: unquoted-builtin_unset ===== unset x a ^ test/runtime-errors.sh:902: Can't unset readonly variable 'a' unset -v x a ^ test/runtime-errors.sh:903: Can't unset readonly variable 'a' ----- STATUS: 0 ===== TEST function: unquoted-builtin_wait ===== wait 1234578 ^~~~~~~ test/runtime-errors.sh:966: 1234578 isn't a child of this shell ----- STATUS: 0 ===== TEST function: unquoted-command_sub_errexit ===== ----- STATUS: 0 ===== TEST function: unquoted-multiple_assign ===== a=1 b=2 x=42 ^~ test/runtime-errors.sh:817: fatal: Can't assign to readonly value 'x' ----- STATUS: 0 ===== TEST function: unquoted-multiple_assign_2 ===== 0 ----- STATUS: 0 ===== TEST function: unquoted-no_such_command_heredoc ===== $(ZZZZZ) ^~~~~ test/runtime-errors.sh:101: 'ZZZZZ' not found one three SHOULD NOT GET HERE ----- STATUS: 0 ===== TEST function: unquoted-nounset ===== echo $x ^~ test/runtime-errors.sh:620: fatal: Undefined variable 'x' ----- STATUS: 0 ===== TEST function: unquoted-nounset_arith ===== echo $(( x )) ^ test/runtime-errors.sh:636: fatal: Undefined variable 'x' ----- STATUS: 0 ===== TEST function: unquoted-patsub_bad_glob ===== echo ${x//[^]} ^ test/runtime-errors.sh:746: fatal: Error matching regex '([^])': Invalid regex syntax (func_regex_first_group_match) ----- STATUS: 0 ===== TEST function: unquoted-pipefail ===== 0 0 ----- STATUS: 0 ===== TEST function: unquoted-pipefail_func ===== 1 1 3 ----- STATUS: 0 ===== TEST function: unquoted-pipefail_group ===== 1 1 3 ----- STATUS: 0 ===== TEST function: unquoted-pipefail_multiple ===== six ----- STATUS: 0 ===== TEST function: unquoted-pipefail_no_words ===== seq 3 | wc -l | > /nonexistent ^ test/runtime-errors.sh:427: Can't open '/nonexistent': Permission denied test/runtime-errors.sh:427: I/O error applying redirect: Permission denied ----- STATUS: 0 ===== TEST function: unquoted-pipefail_subshell ===== 1 1 3 ----- STATUS: 0 ===== TEST function: unquoted-pipefail_while ===== 2 6 12 ----- STATUS: 0 ===== TEST function: unquoted-process_sub_fail ===== a b ----- STATUS: 0 ===== TEST function: unquoted-readonly_assign ===== ===== CASE: -c readonly x=1; x=2 ===== readonly x=1; x=2 ^~ [ -c flag ]:1: fatal: Can't assign to readonly value 'x' ===== CASE: -c readonly x=2; y=3 x=99 ===== readonly x=2; y=3 x=99 ^~ [ -c flag ]:1: fatal: Can't assign to readonly value 'x' ===== CASE: -c readonly x=2; declare x=99 ===== readonly x=2; declare x=99 ^~ [ -c flag ]:1: fatal: Can't assign to readonly value 'x' ===== CASE: -c readonly x=2; export x=99 ===== readonly x=2; export x=99 ^~ [ -c flag ]:1: fatal: Can't assign to readonly value 'x' ----- STATUS: 0 ===== TEST function: unquoted-strict_arith_warnings ===== 1 -yy- ^ [ var ? at line 1006 of test/runtime-errors.sh ]:1: Unexpected end of input -yy- ^ [ var ? at line 1006 of test/runtime-errors.sh ]:1: fatal: Parse error in recursive arithmetic ----- STATUS: 0 ===== TEST function: unquoted-strict_array ===== echo foo > _tmp/"$@" ^~~~ test/runtime-errors.sh:766: Can't redirect to more than one file echo foo > _tmp/"$@" ^~~~ test/runtime-errors.sh:768: Can't redirect to more than one file ----- STATUS: 0 ===== TEST function: unquoted-strict_array_2 ===== local foo="$@" ^ test/runtime-errors.sh:774: fatal: This word should yield a string, but it contains an array ----- STATUS: 0 ===== TEST function: unquoted-strict_array_3 ===== local foo=${1:- "[$@]" } ^~ test/runtime-errors.sh:780: fatal: This word should yield a string, but it contains an array ----- STATUS: 0 ===== TEST function: unquoted-strict_array_4 ===== x[42] = 99 ----- STATUS: 0 ===== TEST function: unquoted-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:997: warning: Invalid start of UTF-8 character -1 ----- STATUS: 0 ===== TEST function: unquoted-string_as_array ===== foo echo "${str[@]}" ^~ test/runtime-errors.sh:829: fatal: Can't index string with @ ----- STATUS: 0 ===== TEST function: unquoted-string_to_hex ===== 1 SHOULD NOT GET HERE ----- STATUS: 0 ===== TEST function: unquoted-string_to_int_arith ===== 5 ZZZ ^~~ [ var ? at line 676 of test/runtime-errors.sh ]:1: fatal: Undefined value in arithmetic context ----- STATUS: 0 ===== TEST function: unquoted-string_to_int_bool ===== a ^ [ var ? at line 760 of test/runtime-errors.sh ]:1: fatal: Undefined value in arithmetic context ----- STATUS: 0 ===== TEST function: unquoted-string_to_intbase ===== 0 SHOULD NOT GET HERE ----- STATUS: 0 ===== TEST function: unquoted-string_to_octal ===== 1 SHOULD NOT GET HERE ----- STATUS: 0 ===== TEST function: unquoted-undef_arith ===== (( undef[42]++ )) ^~ test/runtime-errors.sh:706: fatal: Can't use [] on value of type Str ----- STATUS: 0 ===== TEST function: unquoted-undef_arith2 ===== ['2'] ----- STATUS: 0 ===== TEST function: unquoted-undef_assoc_array ===== bar ----- STATUS: 0 test/runtime-errors.sh: 53 unquoted functions run. TODO: migrate to test-* to assert status /// /// Runtime errors - test functions /// *** Running test-FAIL ===== CASE: -c echo hi > /zzz ===== echo hi > /zzz ^ [ -c flag ]:1: Can't open '/zzz': Permission denied [ -c flag ]:1: I/O error applying redirect: Permission denied OK test-FAIL *** Running test-control_flow ===== CASE: -c break continue echo UNREACHABLE ===== break ^~~~~ [ -c flag ]:2: warning: Invalid control flow at top level continue ^~~~~~~~ [ -c flag ]:3: warning: Invalid control flow at top level UNREACHABLE ===== CASE: -c shopt -s strict_control_flow break continue echo UNREACHABLE ===== break ^~~~~ [ -c flag ]:3: fatal: Invalid control flow at top level OK test-control_flow *** Running test-control_flow_subshell ===== CASE: -c set -o errexit for i in $(seq 2); do echo $i ( break; echo oops) done ===== 1 ( break; echo oops) ^~~~~ [ -c flag ]:5: Loop and control flow can't be in different processes OK test-control_flow_subshell *** Running test-core_process ===== CASE: -c echo foo > not/a/file echo foo > /etc/no-perms-for-this ===== echo foo > not/a/file ^ [ -c flag ]:2: Can't open 'not/a/file': No such file or directory [ -c flag ]:2: I/O error applying redirect: No such file or directory echo foo > /etc/no-perms-for-this ^ [ -c flag ]:3: Can't open '/etc/no-perms-for-this': Permission denied [ -c flag ]:3: I/O error applying redirect: Permission denied OK test-core_process *** Running test-divzero ===== CASE: -c echo $(( 1 / 0 )) ===== echo $(( 1 / 0 )) ^ [ -c flag ]:1: fatal: Divide by zero ===== CASE: -c echo $(( 1 % 0 )) ===== echo $(( 1 % 0 )) ^ [ -c flag ]:1: fatal: Divide by zero ===== CASE: -c zero=0; echo $(( 1 / zero )) ===== zero=0; echo $(( 1 / zero )) ^~~~ [ -c flag ]:1: fatal: Divide by zero ===== CASE: -c zero=0; echo $(( 1 % zero )) ===== zero=0; echo $(( 1 % zero )) ^~~~ [ -c flag ]:1: fatal: Divide by zero ===== CASE: -c (( a = 1 / 0 )); echo non-fatal; exit 1 ===== (( a = 1 / 0 )); echo non-fatal; exit 1 ^ [ -c flag ]:1: fatal: Divide by zero ===== CASE: -c (( a = 1 % 0 )); echo non-fatal; exit 1 ===== (( a = 1 % 0 )); echo non-fatal; exit 1 ^ [ -c flag ]:1: fatal: Divide by zero ===== CASE: -c set -e; (( a = 1 / 0 )); ===== set -e; (( a = 1 / 0 )); ^ [ -c flag ]:1: fatal: Divide by zero ===== CASE: -c set -e; (( a = 1 % 0 )); ===== set -e; (( a = 1 % 0 )); ^ [ -c flag ]:1: fatal: Divide by zero OK test-divzero *** Running test-errexit_alias ===== CASE: -c set -o errexit; type foo; foo /nonexistent ===== foo: not found OK test-errexit_alias *** Running test-errexit_dbracket ===== CASE: -c set -o errexit; [[ -n "" ]]; echo UNREACHABLE ===== OK test-errexit_dbracket *** Running test-errexit_multiple_processes ===== CASE: -c echo t=$(true) f=$(false; true) ===== echo t=$(true) f=$(false; true) ^~~~~ [ -c flag ]:1: errexit PID 10060: command.Simple failed with status 1 [ -c flag ]:1: errexit PID 10056: Command Sub exited with status 1 --------------------------- ===== CASE: -c ls | false | wc -l ===== ls | false | wc -l ^~~~~ [ -c flag ]:1: errexit PID 10065: command.Simple failed with status 1 0 --------------------------- ===== CASE: -c ls | { echo hi; ( exit 42 ); } | wc -l; echo ===== ls | { echo hi; ( exit 42 ); } | wc -l; echo ^ [ -c flag ]:1: errexit PID 10070: command.Subshell failed with status 42 1 ls | { echo hi; ( exit 42 ); } | wc -l; echo ^ [ -c flag ]:1: errexit PID 10066: command.Pipeline failed with status 42 --------------------------- ===== CASE: -c { echo one; ( exit 42 ); } |\ { false; wc -l; } ===== { false; wc -l; } ^~~~~ [ -c flag ]:2: errexit PID 10073: command.Simple failed with status 1 { false; wc -l; } ^ [ -c flag ]:2: errexit PID 10073: command.Pipeline failed with status 1 --------------------------- ===== CASE: -c { ls; false; } \ | wc -l ===== { ls; false; } \ ^~~~~ [ -c flag ]:1: errexit PID 10080: command.Simple failed with status 1 72 { ls; false; } \ ^ [ -c flag ]:1: errexit PID 10077: command.Pipeline failed with status 1 --------------------------- ===== CASE: -c { ls; ( false; true ); } | wc -l; echo hi ===== { ls; ( false; true ); } | wc -l; echo hi ^~~~~ [ -c flag ]:1: errexit PID 10089: command.Simple failed with status 1 { ls; ( false; true ); } | wc -l; echo hi ^ [ -c flag ]:1: errexit PID 10086: command.Subshell failed with status 1 72 { ls; ( false; true ); } | wc -l; echo hi ^ [ -c flag ]:1: errexit PID 10083: command.Pipeline failed with status 1 --------------------------- ===== CASE: -c ls <(sort YY) <(zz); echo hi ===== /dev/fd/4 /dev/fd/5 sort: cannot read: YY: No such file or directory ls <(sort YY) <(zz); echo hi ^~ [ -c flag ]:1: 'zz' not found [ -c flag ]:1: errexit PID 10094: command.Simple failed with status 127 ls <(sort YY) <(zz); echo hi ^~ [ -c flag ]:1: errexit PID 10090: command.Simple failed with status 127 --------------------------- ===== CASE: -c zz <(sort YY) <(sort ZZ); echo hi ===== zz <(sort YY) <(sort ZZ); echo hi ^~ [ -c flag ]:1: 'zz' not found sort: cannot read: ZZ: No such file or directory sort: cannot read: YY: No such file or directory [ -c flag ]:1: errexit PID 10096: command.Simple failed with status 127 --------------------------- ===== CASE: -c yy | zz ===== yy | zz ^~ [ -c flag ]:1: 'zz' not found [ -c flag ]:1: errexit PID 10101: command.Simple failed with status 127 yy | zz ^~ [ -c flag ]:1: 'yy' not found [ -c flag ]:1: errexit PID 10104: command.Simple failed with status 127 yy | zz ^~ [ -c flag ]:1: errexit PID 10101: command.Pipeline failed with status 127 --------------------------- ===== CASE: -c echo $([[ 0 -eq 1 ]]) ===== echo $([[ 0 -eq 1 ]]) ^~ [ -c flag ]:1: errexit PID 10108: command.DBracket failed with status 1 [ -c flag ]:1: errexit PID 10105: Command Sub exited with status 1 --------------------------- ===== CASE: -c var y = $([[ 0 -eq 1 ]]) ===== var y = $([[ 0 -eq 1 ]]) ^~ [ -c flag ]:1: errexit PID 10112: command.DBracket failed with status 1 [ -c flag ]:1: errexit PID 10109: Command Sub exited with status 1 OK test-errexit_multiple_processes *** Running test-errexit_one_process ===== CASE: -c zz ===== zz ^~ [ -c flag ]:1: 'zz' not found [ -c flag ]:1: errexit PID 10115: command.Simple failed with status 127 --------------------------- ===== CASE: -c echo hi > "" ===== echo hi > "" ^ [ -c flag ]:1: Can't open '': No such file or directory [ -c flag ]:1: I/O error applying redirect: No such file or directory [ -c flag ]:1: errexit PID 10118: command.Simple failed with status 1 --------------------------- ===== CASE: -c shopt -s failglob; echo *.ZZZZ ===== shopt -s failglob; echo *.ZZZZ ^ [ -c flag ]:1: failglob: Pattern '*.ZZZZ' matched no files [ -c flag ]:1: errexit PID 10121: command.Simple failed with status 1 --------------------------- ===== CASE: -c cd /x ===== cd /x ^ [ -c flag ]:1: cd '/x': No such file or directory cd /x ^~ [ -c flag ]:1: errexit PID 10124: command.Simple failed with status 1 --------------------------- ===== CASE: -c ./README.md; echo hi ===== ./README.md; echo hi ^ [ -c flag ]:1: Can't execute './README.md': Permission denied ./README.md; echo hi ^ [ -c flag ]:1: errexit PID 10127: command.Simple failed with status 126 ===== CASE: -c ls /x; echo $? ===== ls: cannot access '/x': No such file or directory ls /x; echo $? ^~ [ -c flag ]:1: errexit PID 10131: command.Simple failed with status 2 --------------------------- ===== CASE: -c declare cmd=ls; $cmd /x; echo $? ===== ls: cannot access '/x': No such file or directory declare cmd=ls; $cmd /x; echo $? ^~~~ [ -c flag ]:1: errexit PID 10135: command.Simple failed with status 2 --------------------------- ===== CASE: -c echo $undef ===== echo $undef ^~~~~~ [ -c flag ]:1: fatal: Undefined variable 'undef' --------------------------- ===== CASE: -c eval "(" echo status=$? eval ")" echo status=$? set -e; shopt -s verbose_errexit false echo DONE ===== ( ^ [ 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 10142: command.Simple failed with status 1 --------------------------- ===== CASE: -c [[ 0 -eq 1 ]] ===== [[ 0 -eq 1 ]] ^~ [ -c flag ]:1: errexit PID 10144: command.DBracket failed with status 1 --------------------------- ===== CASE: -c (( 0 )) ===== (( 0 )) ^~ [ -c flag ]:1: You may want a space between parens (parse_dparen) OK test-errexit_one_process *** Running test-errexit_subshell ===== CASE: -c set -o errexit; ( echo subshell; exit 42; ) ===== subshell OK test-errexit_subshell *** Running test-errexit_usage_error ===== CASE: -c set -o errexit; type -z ===== set -o errexit; type -z ^~ [ -c flag ]:1: 'type' doesn't accept flag -z OK test-errexit_usage_error *** Running test-eval_bad_syntax ===== CASE: -c code="if foo; echo ls; fi" eval "echo -- $code" ===== -- if foo; echo ls; fi ^~ [ eval word at line 3 of [ -c flag ] ]:2: Expected word type Id.KW_Then, got Id.KW_Fi OK test-eval_bad_syntax *** Running test-external_cmd_typed_args ===== CASE: -c cat ("myfile") ===== cat ("myfile") ^ [ -c flag ]:1: fatal: 'cat' appears to be external. External commands don't accept typed args (OILS-ERR-200) OK test-external_cmd_typed_args *** Running test-failed_command ===== CASE: -c set -o errexit; false; echo UNREACHABLE ===== OK test-failed_command *** Running test-fallback_locations ===== CASE: -c echo hi > / ===== echo hi > / ^ [ -c flag ]:1: Can't open '/': Is a directory [ -c flag ]:1: I/O error applying redirect: Is a directory ===== CASE: -c s=x; (( s[0] )) ===== s=x; (( s[0] )) ^~ [ -c flag ]:1: fatal: Expected array or assoc in index expression, got Str ===== CASE: -c s=x; (( s[0] = 42 )) ===== s=x; (( s[0] = 42 )) ^ [ -c flag ]:1: fatal: Can't assign to items in a string ===== CASE: -c set -u; (( undef )) ===== set -u; (( undef )) ^~~~~ [ -c flag ]:1: fatal: Undefined variable 'undef' ===== CASE: -c (( 3 ** -2 )) ===== (( 3 ** -2 )) ^ [ -c flag ]:1: fatal: Exponent can't be a negative number ===== CASE: -c set -u; [[ $undef =~ . ]] ===== set -u; [[ $undef =~ . ]] ^~~~~~ [ -c flag ]:1: fatal: Undefined variable 'undef' ===== CASE: -c [[ $x =~ $(( 3 ** -2 )) ]] ===== [[ $x =~ $(( 3 ** -2 )) ]] ^ [ -c flag ]:1: fatal: Exponent can't be a negative number ===== CASE: -c type -x ===== type -x ^~ [ -c flag ]:1: 'type' doesn't accept flag -x ===== CASE: -c use x ===== use x ^ [ -c flag ]:1: 'use' expected 'bin' or 'dialect' ===== CASE: -c export -f ===== export -f ^~~~~~ [ -c flag ]:1: 'export' doesn't accept -f because it's dangerous. (The code can usually be restructured with 'source') ===== CASE: -c s=$(true) y=$(( 3 ** -2 )) ===== s=$(true) y=$(( 3 ** -2 )) ^ [ -c flag ]:1: fatal: Exponent can't be a negative number ===== CASE: -c if s=$(true) y=$(( 3 ** -2 )); then echo hi; fi ===== if s=$(true) y=$(( 3 ** -2 )); then echo hi; fi ^ [ -c flag ]:1: fatal: Exponent can't be a negative number ===== CASE: -c shopt -s strict_arith; x=a; echo $(( x )) ===== a ^ [ var ? at line 1 of [ -c flag ] ]:1: fatal: Undefined value in arithmetic context ===== CASE: -c shopt -s strict_arith; x=a; echo $(( $x )) ===== a ^ [ var ? at line 1 of [ -c flag ] ]:1: fatal: Undefined value in arithmetic context ===== CASE: -c shopt -s strict_arith; x=a; [[ $x -gt 3 ]] ===== a ^ [ var ? at line 1 of [ -c flag ] ]:1: fatal: Undefined value in arithmetic context ===== CASE: -c shopt -s strict_arith; shopt -u eval_unsafe_arith; x=a; [[ $x -gt 3 ]] ===== a ^ [ var ? at line 1 of [ -c flag ] ]:1: fatal: Undefined value in arithmetic context ===== CASE: -c shopt -s strict_arith; x=0xgg; echo $(( x )) ===== shopt -s strict_arith; x=0xgg; echo $(( x )) ^ [ -c flag ]:1: fatal: Invalid hex constant '0xgg' done OK test-fallback_locations *** Running test-no_such_command ===== CASE: -c set -o errexit; ZZZZZ; echo UNREACHABLE ===== set -o errexit; ZZZZZ; echo UNREACHABLE ^~~~~ [ -c flag ]:1: 'ZZZZZ' not found OK test-no_such_command *** Running test-no_such_command_commandsub ===== CASE: -c set -o errexit; echo $(ZZZZZ); echo UNREACHABLE ===== set -o errexit; echo $(ZZZZZ); echo UNREACHABLE ^~~~~ [ -c flag ]:1: 'ZZZZZ' not found UNREACHABLE ===== CASE: -c set -o errexit; shopt -s command_sub_errexit; echo $(ZZZZZ); echo UNREACHABLE ===== set -o errexit; shopt -s command_sub_errexit; echo $(ZZZZZ); echo UNREACHABLE ^~~~~ [ -c flag ]:1: 'ZZZZZ' not found OK test-no_such_command_commandsub *** Running test-osh_state ===== CASE: -c HOME=(a b) ===== HOME=(a b) ^~~~~ [ -c flag ]:1: fatal: Only strings can be exported OK test-osh_state *** Running test-source_bad_syntax ===== CASE: -c . _tmp/bad-syntax.sh ===== if foo; echo ls; fi ^~ _tmp/bad-syntax.sh:1: Expected word type Id.KW_Then, got Id.KW_Fi OK test-source_bad_syntax *** Running test-strict_errexit_1 ===== CASE: [strict_errexit] ! { echo 1; echo 2; } ===== ===== CASE: -c set -o errexit; shopt -s strict_errexit; ! { echo 1; echo 2; } ===== set -o errexit; shopt -s strict_errexit; ! { echo 1; echo 2; } ^ [ -c flag ]:1: fatal: strict_errexit only allows simple commands in conditionals (got command.Pipeline). ===== CASE: [strict_errexit] { echo 1; echo 2; } && true ===== ===== CASE: -c set -o errexit; shopt -s 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 in conditionals (got command.BraceGroup). ===== CASE: [strict_errexit] { echo 1; echo 2; } || true ===== ===== CASE: -c set -o errexit; shopt -s 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 in conditionals (got command.BraceGroup). ===== CASE: [strict_errexit] { echo 1; echo 2; } && true && true ===== ===== CASE: -c set -o errexit; shopt -s 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 in conditionals (got command.BraceGroup). ===== CASE: [strict_errexit] true && { echo 1; echo 2; } || true || true ===== ===== CASE: -c set -o errexit; shopt -s 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 in conditionals (got command.BraceGroup). ===== CASE: [strict_errexit] true && true && { echo 1; echo 2; } || true || true ===== ===== CASE: -c set -o errexit; shopt -s 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 in conditionals (got command.BraceGroup). ===== CASE: [strict_errexit] if { echo 1; echo 2; }; then echo IF; fi ===== ===== CASE: -c set -o errexit; shopt -s 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 in conditionals (got command.Sentence). ===== CASE: [strict_errexit] while { echo 1; echo 2; }; do echo WHILE; done ===== ===== CASE: -c set -o errexit; shopt -s 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 in conditionals (got command.Sentence). ===== CASE: [strict_errexit] until { echo 1; echo 2; }; do echo UNTIL; done ===== ===== CASE: -c set -o errexit; shopt -s 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 in conditionals (got command.Sentence). ===== CASE: [strict_errexit] shopt -s oil:upgrade proc p { echo p } if p { echo hi } ===== ===== CASE: -c set -o errexit; shopt -s strict_errexit; shopt -s oil:upgrade 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 OK test-strict_errexit_1 *** Running test-strict_errexit_conditionals ===== CASE: [strict_errexit] myfunc() { return 1; } while ( myfunc ) do echo yes done ===== ===== CASE: -c set -o errexit; shopt -s strict_errexit; myfunc() { return 1; } while ( myfunc ) do echo yes done ===== while ( myfunc ) ^ [ -c flag ]:4: fatal: strict_errexit only allows simple commands in conditionals (got command.Subshell). ===== CASE: [strict_errexit] myfunc() { return 1; } while test "$(myfunc)" != "" do echo yes done ===== ===== CASE: -c set -o errexit; shopt -s strict_errexit; myfunc() { return 1; } while test "$(myfunc)" != "" do echo yes done ===== while test "$(myfunc)" != "" ^~ [ -c flag ]:4: fatal: Command subs not allowed here because status wouldn't be checked (strict_errexit) ===== CASE: [strict_errexit] myfunc() { return 1; } if cat <(ls) then echo yes fi ===== ===== CASE: -c set -o errexit; shopt -s strict_errexit; myfunc() { return 1; } if cat <(ls) then echo yes fi ===== if cat <(ls) ^~ [ -c flag ]:4: fatal: Process subs not allowed here because status wouldn't be checked (strict_errexit) ===== CASE: [strict_errexit] myfunc() { return 1 } set -o pipefail while myfunc | cat do echo yes done ===== ===== CASE: -c set -o errexit; shopt -s strict_errexit; myfunc() { return 1 } set -o pipefail while myfunc | cat do echo yes done ===== while myfunc | cat ^ [ -c flag ]:7: fatal: strict_errexit only allows simple commands in conditionals (got command.Pipeline). ===== CASE: [strict_errexit] myfunc() { return 1 } foo=$(true) # test assignment without proc while bar=$(false) do echo yes done # issue 1007 was caused using command.ShAssignment, rather than the more common # command.Sentence with ; while spam=$(myfunc) do echo yes done ===== ===== CASE: -c set -o errexit; shopt -s strict_errexit; myfunc() { return 1 } foo=$(true) # test assignment without proc while bar=$(false) do echo yes done # issue 1007 was caused using command.ShAssignment, rather than the more common # command.Sentence with ; while spam=$(myfunc) do echo yes done ===== while bar=$(false) ^~~~ [ -c flag ]:9: fatal: strict_errexit only allows simple commands in conditionals (got command.ShAssignment). OK test-strict_errexit_conditionals *** Running test-strict_errexit_old ===== CASE: [strict_errexit] if ls | wc -l; then echo Pipeline; fi ===== ===== CASE: -c set -o errexit; shopt -s 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: strict_errexit only allows simple commands in conditionals (got command.Sentence). ===== CASE: [strict_errexit] if ! ls | wc -l; then echo Pipeline; fi ===== ===== CASE: -c set -o errexit; shopt -s 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: strict_errexit only allows simple commands in conditionals (got command.Sentence). ===== CASE: [strict_errexit] if echo a && echo b; then echo AndOr; fi ===== ===== CASE: -c set -o errexit; shopt -s 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: strict_errexit only allows simple commands in conditionals (got command.Sentence). ===== CASE: [strict_errexit] ! for x in a; do echo $x; done ===== ===== CASE: -c set -o errexit; shopt -s 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: strict_errexit only allows simple commands in conditionals (got command.Pipeline). ===== CASE: [strict_errexit] _func() { echo; }; ! _func ===== ===== CASE: -c set -o errexit; shopt -s 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 ===== CASE: [strict_errexit] ! { echo brace; }; echo "should not get here" ===== ===== CASE: -c set -o errexit; shopt -s strict_errexit; ! { echo brace; }; echo "should not get here" ===== set -o errexit; shopt -s strict_errexit; ! { echo brace; }; echo "should not get here" ^ [ -c flag ]:1: fatal: strict_errexit only allows simple commands in conditionals (got command.Pipeline). ===== CASE: [strict_errexit] ! ( echo subshell ); echo "should not get here" ===== ===== CASE: -c set -o errexit; shopt -s strict_errexit; ! ( echo subshell ); echo "should not get here" ===== set -o errexit; shopt -s strict_errexit; ! ( echo subshell ); echo "should not get here" ^ [ -c flag ]:1: fatal: strict_errexit only allows simple commands in conditionals (got command.Pipeline). ===== CASE: [strict_errexit] ! while false; do echo while; done; echo "should not get here" ===== ===== CASE: -c set -o errexit; shopt -s strict_errexit; ! while false; do echo while; done; echo "should not get here" ===== set -o errexit; shopt -s strict_errexit; ! while false; do echo while; done; echo "should not get here" ^ [ -c flag ]:1: fatal: strict_errexit only allows simple commands in conditionals (got command.Pipeline). ===== CASE: [strict_errexit] ! if true; then false; fi; echo "should not get here" ===== ===== CASE: -c set -o errexit; shopt -s strict_errexit; ! if true; then false; fi; echo "should not get here" ===== set -o errexit; shopt -s strict_errexit; ! if true; then false; fi; echo "should not get here" ^ [ -c flag ]:1: fatal: strict_errexit only allows simple commands in conditionals (got command.Pipeline). ===== CASE: [strict_errexit] ! case x in x) echo x;; esac; echo "should not get here" ===== ===== CASE: -c set -o errexit; shopt -s strict_errexit; ! case x in x) echo x;; esac; echo "should not get here" ===== set -o errexit; shopt -s strict_errexit; ! case x in x) echo x;; esac; echo "should not get here" ^ [ -c flag ]:1: fatal: strict_errexit only allows simple commands in conditionals (got command.Pipeline). ===== CASE: [strict_errexit] ! time echo hi; echo "should not get here" ===== ===== CASE: -c set -o errexit; shopt -s strict_errexit; ! time echo hi; echo "should not get here" ===== set -o errexit; shopt -s strict_errexit; ! time echo hi; echo "should not get here" ^ [ -c flag ]:1: fatal: strict_errexit only allows simple commands in conditionals (got command.Pipeline). ===== CASE: [strict_errexit] ! echo $(echo hi); echo "should not get here" ===== ===== CASE: -c set -o errexit; shopt -s strict_errexit; ! echo $(echo hi); echo "should not get here" ===== set -o errexit; shopt -s strict_errexit; ! echo $(echo hi); echo "should not get here" ^~ [ -c flag ]:1: fatal: Command subs not allowed here because status wouldn't be checked (strict_errexit) OK test-strict_errexit_old *** Running test-unsafe_arith_eval ===== CASE: -c local e1=1+ local e2="e1 + 5" echo $(( e2 )) # recursively references e1 ===== 1+ ^ [ var ? at line 1 of [ var ? at line 4 of [ -c flag ] ] ]:1: Unexpected end of input 1+ ^ [ var ? at line 1 of [ var ? at line 4 of [ -c flag ] ] ]:1: fatal: Parse error in recursive arithmetic OK test-unsafe_arith_eval *** Running test-unset_expr ===== CASE: -c unset -v 1[1] ===== 1[1] ^ [ dynamic LHS word at line 1 of [ -c flag ] ]:1: fatal: Invalid variable name '1' ===== CASE: -c unset -v 1+2 ===== unset -v 1+2 ^~~~~ [ -c flag ]:1: fatal: Invalid LHS to modify OK test-unset_expr test/runtime-errors.sh: 24 tests passed.