Skip to content
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

[xonsh] Coconut xontrib causes crash when using semi-separated commands #745

Closed
Starwort opened this issue May 21, 2023 · 1 comment
Closed

Comments

@Starwort
Copy link
Contributor

Putting multiple commands on one line with semicolons (e.g. echo; echo) causes a crash with IndexError: list index out of range; the crash does not occur after xontrib unload coconut and continues to occur after xontrib load cooconut

Detailed crash log
xonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = <filename>
Traceback (most recent call last):
  File "/home/starwort/.pyenv/versions/3.11.0/lib/python3.11/site-packages/xonsh/ptk_shell/shell.py", line 384, in _push
    code = self.execer.compile(
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/starwort/.pyenv/versions/3.11.0/lib/python3.11/site-packages/xonsh/execer.py", line 130, in compile
    tree = self.parse(input, ctx, mode=mode, filename=filename, transform=transform)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/starwort/.pyenv/versions/3.11.0/lib/python3.11/site-packages/xonsh/execer.py", line 101, in parse
    tree = self.ctxtransformer.ctxvisit(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/starwort/.pyenv/versions/3.11.0/lib/python3.11/site-packages/xonsh/ast.py", line 376, in ctxvisit
    node = self.visit(node)
           ^^^^^^^^^^^^^^^^
  File "/home/starwort/.pyenv/versions/3.11.0/lib/python3.11/ast.py", line 410, in visit
    return visitor(node)
           ^^^^^^^^^^^^^
  File "/home/starwort/.pyenv/versions/3.11.0/lib/python3.11/ast.py", line 486, in generic_visit
    value = self.visit(value)
            ^^^^^^^^^^^^^^^^^
  File "/home/starwort/.pyenv/versions/3.11.0/lib/python3.11/ast.py", line 410, in visit
    return visitor(node)
           ^^^^^^^^^^^^^
  File "/home/starwort/.pyenv/versions/3.11.0/lib/python3.11/site-packages/xonsh/ast.py", line 491, in visit_Expr
    newnode = self.try_subproc_toks(node)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/starwort/.pyenv/versions/3.11.0/lib/python3.11/site-packages/coconut/integrations.py", line 121, in new_try_subproc_toks
    return ctxtransformer.__class__.try_subproc_toks(ctxtransformer, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/starwort/.pyenv/versions/3.11.0/lib/python3.11/site-packages/xonsh/ast.py", line 398, in try_subproc_toks
    line, nlogical, idx = get_logical_line(self.lines, node.lineno - 1)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/starwort/.pyenv/versions/3.11.0/lib/python3.11/site-packages/xonsh/tools.py", line 581, in get_logical_line
    line = lines[idx]
           ~~~~~^^^^^
IndexError: list index out of range

From the crash log, it seems like Coconut is doing something to change the number of 'logical lines' in a way Xonsh does not expect

Thanks for your time, and your speed in fixing the last xontrib bug!

@evhub evhub added the bug label May 21, 2023
@evhub evhub added this to the v3.0.1 milestone May 21, 2023
evhub added a commit that referenced this issue May 22, 2023
@evhub evhub added the resolved label May 22, 2023
@evhub
Copy link
Owner

evhub commented May 22, 2023

Should be fixed now as of coconut-develop>=3.0.0-post_dev8. Just pip install -U coconut-develop>=3.0.0-post_dev8.

@evhub evhub closed this as completed May 22, 2023
@evhub evhub mentioned this issue May 24, 2023
evhub added a commit that referenced this issue May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants