Results for var-ref.test.sh

statusbash-4osh
pass 2122
ok 22
N-I 10
BUG 30
FAIL 03
total2727
casebash-4oshdescription
0pass pass var ref ${!a}
1pass pass ${!ref-default}
2pass pass ${!undef:-}
3pass pass comparison to ${!array[@]} keys (similar SYNTAX)
4BUG pass ${!a[@]-'default'} is illegal
details
5pass FAIL var ref to $@ with @
details
6pass pass var ref to $1 and $2 with 1 and 2
7pass FAIL var ref: 1, @, *
details
8pass pass var ref to special var BASH_SOURCE
9pass FAIL var ref to $? with '?'
details
10pass pass Var ref, then assignment with ${ := }
11pass pass Var ref, then error with ${ ? }
12pass pass Indirect expansion, THEN suffix operators
13pass pass var ref OF array var -- silent a[0] decay
14pass pass array ref
15N-I pass array ref with strict_array
details
16pass pass var ref TO array var
17pass pass var ref TO array var, with subscripts
18pass pass var ref TO assoc array a[key]
19pass pass var ref TO array with arbitrary subscripts
20BUG pass Bizarre tilde expansion in array index
details
21ok pass Indirect expansion TO fancy expansion features bash disallows
details
22pass ok Bad var ref
details
23pass ok Bad var ref 2
details
24pass pass ${!OPTIND} (used by bash completion
25ok pass var ref doesn't need cycle detection
details
26BUG pass Var Ref Code Injection $(tee PWNED)
details
43 passed, 4 OK, 1 not implemented, 3 BUG, 3 failed, 0 timeouts, 0 cases skipped
3 failed under osh

Details on runs that didn't PASS

bash-44 ${!a[@]-'default'} is illegal

stdout:
['default']
status=0
status=1
stderr:
bash-4.4: line 5: x y z: bad substitution
osh5 var ref to $@ with @

[osh stdout] Expected 'ref=one two\n', got ''
[osh status] Expected 0, got 1
[osh stderr] Found 'Traceback (most recent'

stdout:
stderr: 
Traceback (most recent call last):
  File "/home/uke/oil/bin/oils_for_unix.py", line 202, in <module>
    sys.exit(main(sys.argv))
  File "/home/uke/oil/bin/oils_for_unix.py", line 171, in main
    return AppBundleMain(argv)
  File "/home/uke/oil/bin/oils_for_unix.py", line 141, in AppBundleMain
    return shell.Main('osh', arg_r, environ, login_shell, loader, readline)
  File "/home/uke/oil/core/shell.py", line 1213, in Main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/uke/oil/core/main_loop.py", line 375, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags)
  File "/home/uke/oil/osh/cmd_eval.py", line 2093, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/uke/oil/osh/cmd_eval.py", line 1892, in _Execute
    status = self._Dispatch(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 1619, in _Dispatch
    status = self._DoSimple(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 851, in _DoSimple
    allow_assign=True)
  File "/home/uke/oil/osh/word_eval.py", line 2390, in EvalWordSequence2
    self._EvalWordToParts(w, part_vals, EXTGLOB_FILES)
  File "/home/uke/oil/osh/word_eval.py", line 1859, in _EvalWordToParts
    self._EvalWordPart(p, word_part_vals, eval_flags)
  File "/home/uke/oil/osh/word_eval.py", line 1767, in _EvalWordPart
    self._EvalBracedVarSub(part, part_vals, quoted)
  File "/home/uke/oil/osh/word_eval.py", line 1494, in _EvalBracedVarSub
    vtest_place)
  File "/home/uke/oil/osh/word_eval.py", line 892, in _EvalVarRef
    vtest_place)
  File "/home/uke/oil/osh/word_eval.py", line 1350, in _VarRefValue
    val = self._EvalSpecialVar(part.nake_tok.id, quoted, vsub_state)
AttributeError: 'BracedVarSub' object has no attribute 'nake_tok'
osh7 var ref: 1, @, *

[osh stdout] Expected "['x']\n['x', 'y']\n['x y']\n", got "['x']\n"
[osh status] Expected 0, got 1
[osh stderr] Found 'Traceback (most recent'

stdout:
['x']
stderr:
Traceback (most recent call last):
  File "/home/uke/oil/bin/oils_for_unix.py", line 202, in <module>
    sys.exit(main(sys.argv))
  File "/home/uke/oil/bin/oils_for_unix.py", line 171, in main
    return AppBundleMain(argv)
  File "/home/uke/oil/bin/oils_for_unix.py", line 141, in AppBundleMain
    return shell.Main('osh', arg_r, environ, login_shell, loader, readline)
  File "/home/uke/oil/core/shell.py", line 1213, in Main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/uke/oil/core/main_loop.py", line 375, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags)
  File "/home/uke/oil/osh/cmd_eval.py", line 2093, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/uke/oil/osh/cmd_eval.py", line 1892, in _Execute
    status = self._Dispatch(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 1730, in _Dispatch
    status = self._ExecuteList(node.children)
  File "/home/uke/oil/osh/cmd_eval.py", line 1969, in _ExecuteList
    status = self._Execute(child)
  File "/home/uke/oil/osh/cmd_eval.py", line 1892, in _Execute
    status = self._Dispatch(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 1619, in _Dispatch
    status = self._DoSimple(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 851, in _DoSimple
    allow_assign=True)
  File "/home/uke/oil/osh/word_eval.py", line 2390, in EvalWordSequence2
    self._EvalWordToParts(w, part_vals, EXTGLOB_FILES)
  File "/home/uke/oil/osh/word_eval.py", line 1859, in _EvalWordToParts
    self._EvalWordPart(p, word_part_vals, eval_flags)
  File "/home/uke/oil/osh/word_eval.py", line 1743, in _EvalWordPart
    self._EvalDoubleQuoted(part.parts, part_vals)
  File "/home/uke/oil/osh/word_eval.py", line 1262, in _EvalDoubleQuoted
    self._EvalWordPart(p, part_vals, QUOTED)
  File "/home/uke/oil/osh/word_eval.py", line 1767, in _EvalWordPart
    self._EvalBracedVarSub(part, part_vals, quoted)
  File "/home/uke/oil/osh/word_eval.py", line 1494, in _EvalBracedVarSub
    vtest_place)
  File "/home/uke/oil/osh/word_eval.py", line 892, in _EvalVarRef
    vtest_place)
  File "/home/uke/oil/osh/word_eval.py", line 1350, in _VarRefValue
    val = self._EvalSpecialVar(part.nake_tok.id, quoted, vsub_state)
AttributeError: 'BracedVarSub' object has no attribute 'nake_tok'
osh9 var ref to $? with '?'

[osh stdout] Expected 'myfunc\n0\n', got 'myfunc\n'
[osh status] Expected 0, got 1
[osh stderr] Found 'Traceback (most recent'

stdout:
myfunc
stderr:
Traceback (most recent call last):
  File "/home/uke/oil/bin/oils_for_unix.py", line 202, in <module>
    sys.exit(main(sys.argv))
  File "/home/uke/oil/bin/oils_for_unix.py", line 171, in main
    return AppBundleMain(argv)
  File "/home/uke/oil/bin/oils_for_unix.py", line 141, in AppBundleMain
    return shell.Main('osh', arg_r, environ, login_shell, loader, readline)
  File "/home/uke/oil/core/shell.py", line 1213, in Main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/uke/oil/core/main_loop.py", line 375, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags)
  File "/home/uke/oil/osh/cmd_eval.py", line 2093, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/uke/oil/osh/cmd_eval.py", line 1892, in _Execute
    status = self._Dispatch(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 1619, in _Dispatch
    status = self._DoSimple(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 906, in _DoSimple
    status = self._RunSimpleCommand(cmd_val, cmd_st, run_flags)
  File "/home/uke/oil/osh/cmd_eval.py", line 567, in _RunSimpleCommand
    run_flags)
  File "/home/uke/oil/core/executor.py", line 420, in RunSimpleCommand
    status = self.cmd_ev.RunProc(proc, cmd_val)
  File "/home/uke/oil/osh/cmd_eval.py", line 2289, in RunProc
    status = self._Execute(proc.body)
  File "/home/uke/oil/osh/cmd_eval.py", line 1892, in _Execute
    status = self._Dispatch(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 1738, in _Dispatch
    status = self._ExecuteList(node.children)
  File "/home/uke/oil/osh/cmd_eval.py", line 1969, in _ExecuteList
    status = self._Execute(child)
  File "/home/uke/oil/osh/cmd_eval.py", line 1892, in _Execute
    status = self._Dispatch(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 1619, in _Dispatch
    status = self._DoSimple(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 851, in _DoSimple
    allow_assign=True)
  File "/home/uke/oil/osh/word_eval.py", line 2390, in EvalWordSequence2
    self._EvalWordToParts(w, part_vals, EXTGLOB_FILES)
  File "/home/uke/oil/osh/word_eval.py", line 1859, in _EvalWordToParts
    self._EvalWordPart(p, word_part_vals, eval_flags)
  File "/home/uke/oil/osh/word_eval.py", line 1767, in _EvalWordPart
    self._EvalBracedVarSub(part, part_vals, quoted)
  File "/home/uke/oil/osh/word_eval.py", line 1494, in _EvalBracedVarSub
    vtest_place)
  File "/home/uke/oil/osh/word_eval.py", line 892, in _EvalVarRef
    vtest_place)
  File "/home/uke/oil/osh/word_eval.py", line 1350, in _VarRefValue
    val = self._EvalSpecialVar(part.nake_tok.id, quoted, vsub_state)
AttributeError: 'BracedVarSub' object has no attribute 'nake_tok'
bash-415 array ref with strict_array

stdout:
ale
stderr:
bash-4.4: line 1: shopt: strict_array: invalid shell option name
bash-420 Bizarre tilde expansion in array index

stdout:
y
stderr:
bash-421 Indirect expansion TO fancy expansion features bash disallows

stdout:
done
stderr:
main: line 2: a[0: bad substitution
main: line 2: aa[k: bad substitution
main: line 2: !x: bad substitution
main: line 2: !a[0]: bad substitution
main: line 2: x:-foo: bad substitution
main: line 2: x:=foo: bad substitution
main: line 2: x:?oops: bad substitution
main: line 2: x:+yy: bad substitution
main: line 2: x:0: bad substitution
main: line 2: x:0:1: bad substitution
main: line 2: !a@: bad substitution
main: line 2: #x: bad substitution
main: line 2: x#y: bad substitution
main: line 2: x/y/foo: bad substitution
main: line 2: x@Q: bad substitution
osh22 Bad var ref

stdout:
stderr: 
  bad var name
     ^
[ contents of var 'a' at line 2 of [ stdin ] ]:1: Expected end of var ref expression
  echo ref ${!a}
              ^
[ stdin ]:2: fatal: Invalid var ref expression
osh23 Bad var ref 2

stdout:
stderr: 
  /
  ^
[ contents of var 'b' at line 2 of [ stdin ] ]:1: Expected var name
  echo ref ${!b}
              ^
[ stdin ]:2: fatal: Invalid var ref expression
bash-425 var ref doesn't need cycle detection

stdout:
cycle=x
cycle=
stderr:
bash-4.4: line 7: warning: a: circular name reference
bash-426 Var Ref Code Injection $(tee PWNED)

stdout:
42
PWNED
0
stderr: