New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`[` aborts OSH #82

Closed
timetoplatypus opened this Issue Feb 4, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@timetoplatypus
Contributor

timetoplatypus commented Feb 4, 2018

Was looking into OSH builtins and ran the following. It causes a fault that aborts OSH.

osh$ echo "Hello!"
Hello!
osh$ [
Traceback (most recent call last):
  File "bin/osh", line 504, in <module>
    main(sys.argv)
  File "bin/osh", line 487, in main
    sys.exit(OilMain(argv))
  File "bin/osh", line 470, in OilMain
    status = OshMain(main_argv, login_shell)
  File "bin/osh", line 326, in OshMain
    InteractiveLoop(opts, ex, c_parser, w_parser, line_reader)
  File "bin/osh", line 132, in InteractiveLoop
    status = ex.Execute(node)
  File "/home/timetoplatypus/oil-dev/oil/bin/../core/cmd_exec.py", line 1192, in Execute
    status = self._Execute(node, fork_external=fork_external)
  File "/home/timetoplatypus/oil-dev/oil/bin/../core/cmd_exec.py", line 1145, in _Execute
    status, check_errexit = self._Dispatch(node, fork_external)
  File "/home/timetoplatypus/oil-dev/oil/bin/../core/cmd_exec.py", line 882, in _Dispatch
    status = self._ExecuteList(node.children)
  File "/home/timetoplatypus/oil-dev/oil/bin/../core/cmd_exec.py", line 1166, in _ExecuteList
    status = self._Execute(child)  # last status wins
  File "/home/timetoplatypus/oil-dev/oil/bin/../core/cmd_exec.py", line 1145, in _Execute
    status, check_errexit = self._Dispatch(node, fork_external)
  File "/home/timetoplatypus/oil-dev/oil/bin/../core/cmd_exec.py", line 712, in _Dispatch
    status = self._RunSimpleCommand(argv, fork_external)
  File "/home/timetoplatypus/oil-dev/oil/bin/../core/cmd_exec.py", line 554, in _RunSimpleCommand
    status = self._RunBuiltin(builtin_id, argv)
  File "/home/timetoplatypus/oil-dev/oil/bin/../core/cmd_exec.py", line 351, in _RunBuiltin
    status = test_builtin.Test(argv, True)  # need_right_bracket
  File "/home/timetoplatypus/oil-dev/oil/bin/../core/test_builtin.py", line 122, in Test
    if argv[-1] != ']':
IndexError: list index out of range
$bash>

Running just [ is rightly invalid but I imagine the desirable behavior is simply printing an error message then moving on to the next OSH prompt, not terminating OSH entirely.

andychu pushed a commit that referenced this issue Feb 4, 2018

@andychu

This comment has been minimized.

Show comment
Hide comment
@andychu

andychu Feb 4, 2018

Contributor

Thanks, just fixed it!

Unfortunately I just made a release, but this can go in the next release :)

Contributor

andychu commented Feb 4, 2018

Thanks, just fixed it!

Unfortunately I just made a release, but this can go in the next release :)

@timetoplatypus

This comment has been minimized.

Show comment
Hide comment
@timetoplatypus

timetoplatypus Feb 4, 2018

Contributor

👍

Contributor

timetoplatypus commented Feb 4, 2018

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment