Repository navigation
[xonsh] Coconut xontrib causes crash when using semi-separated commands #745
Copy link
Copy link
Closed
Description
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!
Reactions are currently unavailable
Activity
Fix xonsh line lookup
evhub commentedon May 22, 2023
Should be fixed now as of
coconut-develop>=3.0.0-post_dev8. Justpip install -U coconut-develop>=3.0.0-post_dev8.Fix xonsh line lookup