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

coconut makes .xonshrc take an unreasonable amount of time to load #724

Closed
Starwort opened this issue Mar 28, 2023 · 4 comments
Closed

coconut makes .xonshrc take an unreasonable amount of time to load #724

Starwort opened this issue Mar 28, 2023 · 4 comments

Comments

@Starwort
Copy link
Contributor

When I have coconut installed (it doesn't seem like I can even disable this behaviour), starting a new instance of xonsh hangs for seemingly forever (~3m!) during xonshrc evaluation.

xontrib unload coconut didn't seem to have any effect (coconut is an auto xontrib)

Also, my xonshrc errors with an out-of-bounds list index when coconut is enabled

Launch with coconut installed:
Launch with coconut installed

After uninstalling coconut (so fast it doesn't get a process timer!):
After uninstalling coconut

@evhub evhub added the bug label Mar 30, 2023
@evhub evhub added this to the v3.0.0 milestone Mar 30, 2023
@evhub
Copy link
Owner

evhub commented Mar 30, 2023

What version of Coconut are you using (coconut --version)? This was a problem with older versions but in my testing seems to be fixed on the current version. Would also help if I could see the .xonshrc file in question and a traceback for the IndexError (just set $XONSH_SHOW_TRACEBACK as in the error message).

evhub added a commit that referenced this issue Mar 30, 2023
@evhub
Copy link
Owner

evhub commented Mar 30, 2023

Also, xontrib unload coconut should work now on coconut-develop. pip install -U coconut-develop>=3.0.0-a_dev18 to get the fix.

evhub added a commit that referenced this issue Mar 31, 2023
@Starwort
Copy link
Contributor Author

Starwort commented Apr 1, 2023

What version of Coconut are you using (coconut --version)?

Coconut: Version 2.2.0 running on Python 3.11.0 and Cython cPyparsing v2.4.7.1.2.0

Would also help if I could see the .xonshrc file in question and a traceback for the IndexError if you can get one.

https://starbright.dyndns.org/starwort/.xonshrc

Waiting on the IndexError but obviously that's taking a bit 🙃

EDIT: Here's the traceback

You may be attempting to source non-xonsh file! If you are trying to source a file in another language, then please use the appropriate source command. For example, source-bash script.sh
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/procs/proxies.py", line 820, in wait
    r = self.f(self.args, stdin, stdout, stderr, spec, spec.stack)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/starwort/.pyenv/versions/3.11.0/lib/python3.11/site-packages/xonsh/procs/proxies.py", line 299, in proxy_two
    return f(args, stdin)
           ^^^^^^^^^^^^^^
  File "/home/starwort/.pyenv/versions/3.11.0/lib/python3.11/site-packages/xonsh/aliases.py", line 596, in source_alias
    XSH.builtins.execx(src, "exec", ctx, filename=fpath)
  File "/home/starwort/.pyenv/versions/3.11.0/lib/python3.11/site-packages/xonsh/execer.py", line 207, in exec
    return exec(code, glbs, locs)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/starwort/.xonshrc", line 194, in <module>
    aliases['fixmouse'] = 'sudo modprobe -r hid_multitouch; sudo modprobe hid_multitouch'
    
  File "/home/starwort/.pyenv/versions/3.11.0/lib/python3.11/site-packages/xonsh/aliases.py", line 178, in __setitem__
    elif isexpression(val):
         ^^^^^^^^^^^^^^^^^
  File "/home/starwort/.pyenv/versions/3.11.0/lib/python3.11/site-packages/xonsh/ast.py", line 315, in isexpression
    node = XSH.execer.parse(node, ctx, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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/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

Seems like it's breaking something internal to xonsh

Second edit: For good measure, my xonsh is 0.13.4

@evhub
Copy link
Owner

evhub commented Apr 1, 2023

Looks like it is what I was suspicious about, which is an execx issue. I disabled Coconut in execx on the latest coconut-develop, so I think it should be fixed now if you pip uninstall coconut and pip install -U coconut-develop>=3.0.0-a_dev19.

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