agkozak / agkozak-zsh-prompt

A fast, asynchronous Zsh prompt with color ASCII indicators of Git, exit, SSH, virtual environment, and vi mode status. Framework-agnostic and customizable.
MIT License
290 stars 26 forks source link

emacs' exec-path-from-shell crashes #5

Closed xificurC closed 3 years ago

xificurC commented 6 years ago

Hi,

this theme crashes emacs when using exec-path-from-shell. To reproduce just load the package in emacs and run (exec-path-from-shell-printf "foo%s" '("bar"))

agkozak commented 6 years ago

@xificurC,

Thanks for reporting this.

Do you get any sort of error message?

And what is your overall setup, i.e are you running vanilla emacs, Spacemacs -- anything unusual?

Alex

agkozak commented 6 years ago

exec-path-from-shell-printf

It seems to work for me with no problem.

xificurC commented 6 years ago

Hi @agkozak , thank you for your quick response. I really like your prompt, so I hope you're right and there's another issue on my part.

I'm extremely busy right now but the moment I find some spare time I will double check my findings.

What happened was I was getting a SIGTERM (emacs exited 15) with no information whatsoever. Running in gdb got me this stacktrace, which wasn't that much helpful. Then I tried running it with strace and found out it's probably dying with exec-path-from-shell. Switching exec-path-from-shell's shell from zsh to bash solved the issue. Then I tried removing your theme from my .zshrc (using zgen) and emacs with zsh worked again. Putting it back in I got SIGTERMed again.

For more information I am running ubu 18.04, emacs 25.3.1, spacemacs from develop branch (0.300.0) and zsh 5.4.2. I was debugging in emacs -q (so no spacemacs), just doing a (load "path/to/exec-path-from-shell.el") and running its printf.

agkozak commented 6 years ago

Thanks, @xificurC! I'll spin up a VM later and try to recreate what you're seeing.

If you get a chance, though, could you try this? In your .zshrc, right before zgen loads my prompt, put

export AGKOZAK_FORCE_ASYNC_METHOD=none

Reload ZSH and see if that fixes it. What that setting does is to turn off the two asynchronous methods of loading the right prompt. If that makes the problem go away, then try

export AGKOZAK_FORCE_ASYNC_METHOD=usr1

Reload ZSH and see if that fixes it. If it does, then we'll know that the problem originates in the default zsh-async method.

agkozak commented 6 years ago

Also, would you share your .zshrc with me? I'd like to see if any plugins are conflicting.

xificurC commented 6 years ago

Well, exporting none works, exporting usr1 works, not exporting anything works... I'll leave it as a heisenbug for now and come back if it happens again. Thank you for your time

xificurC commented 6 years ago

The list of plugins I'm loading (in this order) is

willghatch/zsh-cdr
zsh-users/zaw
zsh-users/zsh-autosuggestions
agkozak/agkozak-zsh-theme
zsh-users/zsh-syntax-highlighting
Tarrasch/zsh-functional
agkozak commented 6 years ago

I made some additions to the develop branch of this repository to try to handle the problem you're running into. The idea is to detect when $TERM is dumb; when it is, the asynchronous features are bypassed. See if that helps. Make sure you aren't setting TERM to anything in your dotfiles, though -- then it won't work.

agkozak commented 6 years ago

All right. I pushed out a number of commits to master that relate to Emacs. I don't think you should need to use AGKOZAK_FORCE_ASYNC_METHOD in your .zshrc anymore. i don't normally use Emacs myself, so I'm particularly grateful for the feedback.

xificurC commented 6 years ago

Actually I realized I've put exec-path-from-shell into the list of excluded packages, which means (spac)emacs wasn't loading it at all. So my previous test where both none and usr1 worked is moot. I just tried with the latest changes from master and, sadly, no. Both none and usr1 die the same way as before. Not using the prompt or exec-path-from-shell both solve the issue.

agkozak commented 6 years ago

I keep trying to reproduce the error on my own system, but with no luck. I'm running Ubuntu 18.04 in VirtualBox with zsh 5.4.2, agkozak-zsh-theme, Emacs 25.2.2, and Spacemacs 0.300.0.

I'm running the elisp commands both from a buffer (line-by-line, C-x C-e) and in ielm, both in the terminal version of Emacs (emacs -nw) and in the GUI. Everything you describe works without a hitch -- I can print out environment variables and everything. Let me know if there's anything else I can do to reproduce what you're doing -- I'm a Vim guy, so there may be something obvious that Emacs people type constantly that I don't know about.

Perhaps you could try downloading my .zshrc and .shrc (you need both; the one sources the other) and see if my ZSH configuration makes the error go away? If it does, we will have made great progress. (My .zshrc will install zplugin -- don't worry; you can get rid of it when you're done with rm -rf ~/.zplugin).