Powerlevel10k: Terminal Hangs after 1st command

Created on 3 Feb 2020  ·  18Comments  ·  Source: romkatv/powerlevel10k

With the current version of powerlevel10k, my shell is hanging after issuing the first command after loading the shell. It can even be a simple return. I have to ctrl-c to get the prompt again. After the first command, the prompt load fine (and I get the initial prompt successfully as well.) This has been confirmed on two different computers.

Most helpful comment

For the record, here's the patch I sent for the bug in Zsh: https://www.zsh.org/mla/workers//2020/msg00207.html. Will commit in a few days unless someone on the Zsh mailing list objects.

The patch has been merged (https://github.com/zsh-users/zsh/commit/754fdc6580192e81ecc0628349102308868b4857). This happened before zsh 5.8 release was cut. This is good -- zsh 5.8 won't have this bug.

All 18 comments

Please attach your ~/.zshrc and post the output of the following command:

uname -a
typeset -pm 'POWERLEVEL9K_*|ZSH_VERSION'

zshrc.txt

Darwin CHILTZ120209Mac.local 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan  9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64
typeset POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND=8
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VIVIS_FOREGROUND=76
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VIVIS_CONTENT_EXPANSION=Ⅴ
typeset POWERLEVEL9K_SHORTEN_DELIMITER=''
typeset POWERLEVEL9K_RVM_SHOW_PREFIX=false
typeset POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=''
typeset POWERLEVEL9K_CONTEXT_TEMPLATE=%n@%m
typeset POWERLEVEL9K_OS_ICON_FOREGROUND=255
typeset POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=3
typeset POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=255
typeset POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40
typeset POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3
typeset POWERLEVEL9K_BATTERY_CHARGED_FOREGROUND=2
typeset -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( os_icon dir vcs )
typeset POWERLEVEL9K_VI_MODE_VISUAL_BACKGROUND=4
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VIINS_CONTENT_EXPANSION=❯
typeset POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false
typeset POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='\uE0B2'
typeset POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=true
typeset POWERLEVEL9K_BATTERY_VERBOSE=false
typeset POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
typeset POWERLEVEL9K_VPN_IP_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER// }'
typeset POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER// }'
typeset POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VIINS_FOREGROUND=196
typeset POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND=0
typeset POWERLEVEL9K_RVM_SHOW_GEMSET=false
typeset POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION='${P9K_KUBECONTEXT_CLOUD_CLUSTER:-${P9K_KUBECONTEXT_NAME}}${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}'
typeset -a POWERLEVEL9K_KUBECONTEXT_CLASSES=( '*' DEFAULT )
typeset ZSH_VERSION=5.7.1
typeset POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL=''
typeset POWERLEVEL9K_CONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION=''
typeset POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter(1)))+${my_git_format}}'
typeset POWERLEVEL9K_NODEENV_LEFT_DELIMITER=''
typeset POWERLEVEL9K_NORDVPN_CONNECTING_VISUAL_IDENTIFIER_EXPANSION=''
typeset POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=7
typeset POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=0
typeset POWERLEVEL9K_BATTERY_CHARGING_FOREGROUND=2
typeset POWERLEVEL9K_ANACONDA_SHOW_PYTHON_VERSION=false
typeset POWERLEVEL9K_VI_INSERT_MODE_STRING=''
typeset POWERLEVEL9K_VCS_BRANCH_ICON=' '
typeset POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='\uE0B1'
typeset POWERLEVEL9K_PROMPT_CHAR_LEFT_LEFT_WHITESPACE=''
typeset POWERLEVEL9K_STATUS_OK=true
typeset POWERLEVEL9K_VI_VISUAL_MODE_STRING=VISUAL
typeset POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
typeset POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION=↵
typeset POWERLEVEL9K_VI_MODE_OVERWRITE_BACKGROUND=3
typeset POWERLEVEL9K_NORDVPN_DISCONNECTING_VISUAL_IDENTIFIER_EXPANSION=''
typeset POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY=true
typeset POWERLEVEL9K_CONTEXT_SUDO_CONTENT_EXPANSION=''
typeset POWERLEVEL9K_DIR_MAX_LENGTH=80
typeset -a POWERLEVEL9K_VCS_BACKENDS=( git )
typeset POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false
typeset POWERLEVEL9K_VCS_UNTRACKED_ICON='?'
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VICMD_FOREGROUND=76
typeset POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
typeset POWERLEVEL9K_DIR_ANCHOR_BOLD=true
typeset POWERLEVEL9K_NORDVPN_DISCONNECTED_VISUAL_IDENTIFIER_EXPANSION=''
typeset POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique
typeset POWERLEVEL9K_DIR_SHOW_WRITABLE=true
typeset POWERLEVEL9K_PROMPT_CHAR_BACKGROUND=''
typeset POWERLEVEL9K_INSTANT_PROMPT=off
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VIVIS_CONTENT_EXPANSION=Ⅴ
typeset POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER// }'
typeset POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
typeset POWERLEVEL9K_STATUS_ERROR=true
typeset POWERLEVEL9K_DIR_FOREGROUND=254
typeset POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' '
typeset POWERLEVEL9K_CONTEXT_BACKGROUND=0
typeset POWERLEVEL9K_TRANSIENT_PROMPT=off
typeset POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL=''
typeset POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX=%242F─╮
typeset POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX=%242F─┤
typeset POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false
typeset POWERLEVEL9K_NORDVPN_DISCONNECTED_CONTENT_EXPANSION=''
typeset POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION=✔
typeset POWERLEVEL9K_CONTEXT_SUDO_VISUAL_IDENTIFIER_EXPANSION=''
typeset POWERLEVEL9K_CONTEXT_DEFAULT_CONTENT_EXPANSION=''
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VICMD_CONTENT_EXPANSION=❮
typeset POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR='\uE0B3'
typeset POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=''
typeset POWERLEVEL9K_SHORTEN_FOLDER_MARKER='(.bzr|.citc|.git|.hg|.node-version|.python-version|.ruby-version|.shorten_folder_marker|.svn|.terraform|CVS|Cargo.toml|composer.json|go.mod|package.json)'
typeset POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER=''
typeset POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=%242F╭─
typeset POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX=%242F├─
typeset POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='\uE0B0'
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VIOWR_CONTENT_EXPANSION=▶
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VIVIS_FOREGROUND=196
typeset POWERLEVEL9K_NORDVPN_CONNECTING_CONTENT_EXPANSION=''
typeset POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT=50
typeset POWERLEVEL9K_VIRTUALENV_LEFT_DELIMITER=''
typeset POWERLEVEL9K_GO_VERSION_PROJECT_ONLY=true
typeset POWERLEVEL9K_DISABLE_HOT_RELOAD=true
typeset POWERLEVEL9K_DIR_HYPERLINK=false
typeset POWERLEVEL9K_VCS_UNSTAGED_MAX_NUM=-1
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VIINS_FOREGROUND=76
typeset POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=OVERTYPE
typeset POWERLEVEL9K_VCS_STAGED_MAX_NUM=-1
typeset POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX=%242F─╯
typeset POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1
typeset POWERLEVEL9K_VPN_IP_INTERFACE='(wg|(.*tun))[0-9]*'
typeset POWERLEVEL9K_BATTERY_LOW_FOREGROUND=1
typeset -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( status command_execution_time background_jobs virtualenv pyenv load )
typeset POWERLEVEL9K_NODEENV_RIGHT_DELIMITER=''
typeset POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
typeset POWERLEVEL9K_VCS_CONFLICTED_MAX_NUM=-1
typeset POWERLEVEL9K_PROMPT_CHAR_LEFT_RIGHT_WHITESPACE=''
typeset POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION=↵
typeset POWERLEVEL9K_ANACONDA_LEFT_DELIMITER=''
typeset POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true
typeset POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false
typeset POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE=%n@%m
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VIINS_CONTENT_EXPANSION=❯
typeset POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX=%242F╰─
typeset POWERLEVEL9K_STATUS_ERROR_PIPE=true
typeset POWERLEVEL9K_DIRENV_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}'
typeset POWERLEVEL9K_PROMPT_ADD_NEWLINE=false
typeset POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false
typeset POWERLEVEL9K_VCS_COMMITS_BEHIND_MAX_NUM=-1
typeset POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION=✔
typeset POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0B2'
typeset POWERLEVEL9K_BATTERY_STAGES=
typeset POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION=''
typeset POWERLEVEL9K_KUBECONTEXT_DEFAULT_BACKGROUND=5
typeset POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND=3
typeset POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
typeset POWERLEVEL9K_VIRTUALENV_RIGHT_DELIMITER=''
typeset POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND=2
typeset POWERLEVEL9K_VCS_UNTRACKED_MAX_NUM=-1
typeset POWERLEVEL9K_VI_MODE_FOREGROUND=0
typeset POWERLEVEL9K_STATUS_OK_PIPE=true
typeset POWERLEVEL9K_MODE=nerdfont-complete
typeset POWERLEVEL9K_VCS_COMMITS_AHEAD_MAX_NUM=-1
typeset POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_BACKGROUND=''
typeset POWERLEVEL9K_STATUS_ERROR_SIGNAL=true
typeset POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION=↵
typeset POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0B0'
typeset POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY=true
typeset POWERLEVEL9K_LOAD_WHICH=5
typeset POWERLEVEL9K_CONTEXT_FOREGROUND=3
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VICMD_CONTENT_EXPANSION=❮
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VICMD_FOREGROUND=196
typeset POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL=''
typeset POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false
typeset POWERLEVEL9K_NODEENV_SHOW_NODE_VERSION=false
typeset POWERLEVEL9K_VI_COMMAND_MODE_STRING=NORMAL
typeset POWERLEVEL9K_STATUS_EXTENDED_STATES=true
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VIOWR_CONTENT_EXPANSION=▶
typeset POWERLEVEL9K_NORDVPN_DISCONNECTING_CONTENT_EXPANSION=''
typeset POWERLEVEL9K_ICON_BEFORE_CONTENT=''
typeset POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=250
typeset POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='%B${P9K_CONTENT// }'

Please do the following.

  1. Close all terminal windows.
  2. Open one terminal window.
  3. Hit Ctrl-C to get a working prompt.
  4. Type exec zsh -x. Wait for prompt to hang.
  5. Post all output up to the point of hanging (there can be a lot of it, so you might want to attach it as a file).
  6. Open another terminal window (leave the first one hanging).
  7. Hit Ctrl-C in the second window to get a working prompt.
  8. Type exec bash.
  9. Type ps and post the output here.
  10. Type ls ${TMPDIR:-/tmp}/p10k-instant-prompt-output-* and post the output here.
  11. Type cat ${TMPDIR:-/tmp}/p10k-instant-prompt-output-* and post the output here (there can be a lot of it, so you might want to attach it as a file).

exec_zsh_x.txt

Attached is the output of exec zsh -x

here is the output from ps in the bash shell:

`  PID TTY           TIME CMD
 9125 ttys000    0:00.03 /Applications/iTerm.app/Contents/MacOS/iTerm2 --server login -fp rblount
 9127 ttys000    0:00.73 zsh -x
 9194 ttys000    0:00.00 zsh -dfxc \012        exec >&4\012        echo $$\012        /Users/rblount/OneDrive/zsh/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-d
 9195 ttys000    0:00.03 /Users/rblount/OneDrive/zsh/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 --lock-fd=3 --parent-pid=9127 --num-threads=16 -
 9203 ttys000    0:00.00 zsh -x
 9204 ttys000    0:00.01 zsh -x
 9210 ttys001    0:00.03 /Applications/iTerm.app/Contents/MacOS/iTerm2 --server login -fp rblount
 9212 ttys001    0:00.49 bash
  714 ttys005    0:00.47 /bin/zsh -l
  739 ttys005    0:00.01 zsh -dfxc \012        exec >&4\012        echo $$\012        /Users/rblount/OneDrive/zsh/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-d
  740 ttys005    0:00.20 /Users/rblount/OneDrive/zsh/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 --lock-fd=3 --parent-pid=714 --num-threads=16 --
  754 ttys005    0:00.00 /bin/zsh -l
  755 ttys005    0:00.03 /bin/zsh -l

I do not see any p10k-instant-prompt-output-* files in the tmp directory

No luck. Logs don't indicate any hanging. Everything seems to have worked fine. Let's try to reduce your zshrc to make debugging easier. Please backup your ~/.zshrc and then try reproducing the problem with the content of ~/.zshrc replaced with Config 1 posted below. If it hangs (it should, because it's the same config as yours), try Config 2 and so on. Let me know the last config for which you still experience this issue.

Config 1

if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="/Users/rblount/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=(git mac-zsh-completions zsh-syntax-highlighting zsh-autosuggestions z)
source $ZSH/oh-my-zsh.sh
alias zshconfig="bbedit ~/.zshrc"
local WORDCHARS='*?_[]~=&;!#$%^(){}<>'
setopt CORRECT_ALL
SPROMPT="Correct %F{red}%R%f to %F{green}%r%f [nyae]?"
compinit
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

Config 2

export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="/Users/rblount/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=(git mac-zsh-completions zsh-syntax-highlighting zsh-autosuggestions z)
source $ZSH/oh-my-zsh.sh
alias zshconfig="bbedit ~/.zshrc"
local WORDCHARS='*?_[]~=&;!#$%^(){}<>'
setopt CORRECT_ALL
SPROMPT="Correct %F{red}%R%f to %F{green}%r%f [nyae]?"
compinit
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

Config 3

export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="/Users/rblount/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=(git mac-zsh-completions zsh-syntax-highlighting zsh-autosuggestions z)
source $ZSH/oh-my-zsh.sh
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

Config 4

export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="/Users/rblount/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=()
source $ZSH/oh-my-zsh.sh
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

Config 5

source /Users/rblount/.oh-my-zsh/powerlevel10k/powerlevel10k.zsh-theme
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

Config 6

source /Users/rblount/.oh-my-zsh/powerlevel10k/powerlevel10k.zsh-theme
POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true

Config 7

true

Thanks for the troubleshooting. I have confirm that the issue disappears at Confg 5. Using that, I did some additional troubleshooting and confirmed that the error is reproducible if I use:

source $ZSH/oh-my-zsh.sh
If I use:
source /Users/rblount/.oh-my-zsh/powerlevel10k/powerlevel10k.zsh-theme

The issue no longer occurs. For testing, I did check setting an alternative theme as ZSH_THEME and the issue do not occur either.

Thanks for continuing to troubleshoot with me.

-Rob

On Feb 3, 2020, at 9:10 AM, Roman Perepelitsa notifications@github.com wrote:

No luck. Logs don't indicate any hanging. Everything seems to have worked fine. Let's try to reduce your zshrc to make debugging easier. Please backup your ~/.zshrc and then try reproducing the problem with the content of ~/.zshrc replaced with Config 1 posted below. If it hangs (it should, because it's the same config as yours), try Config 2 and so on. Let me know the last config for which you still experience this issue.

Config 1

if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="/Users/rblount/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=(git mac-zsh-completions zsh-syntax-highlighting zsh-autosuggestions z)
source $ZSH/oh-my-zsh.sh
alias zshconfig="bbedit ~/.zshrc"
local WORDCHARS='*?_[]~=&;!#$%^(){}<>'
setopt CORRECT_ALL
SPROMPT="Correct %F{red}%R%f to %F{green}%r%f [nyae]?"
compinit
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
Config 2

export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="/Users/rblount/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=(git mac-zsh-completions zsh-syntax-highlighting zsh-autosuggestions z)
source $ZSH/oh-my-zsh.sh
alias zshconfig="bbedit ~/.zshrc"
local WORDCHARS='*?_[]~=&;!#$%^(){}<>'
setopt CORRECT_ALL
SPROMPT="Correct %F{red}%R%f to %F{green}%r%f [nyae]?"
compinit
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
Config 3

export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="/Users/rblount/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=(git mac-zsh-completions zsh-syntax-highlighting zsh-autosuggestions z)
source $ZSH/oh-my-zsh.sh
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
Config 4

export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="/Users/rblount/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=()
source $ZSH/oh-my-zsh.sh
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
Config 5

source /Users/rblount/.oh-my-zsh/powerlevel10k/powerlevel10k.zsh-theme
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
Config 6

source /Users/rblount/.oh-my-zsh/powerlevel10k/powerlevel10k.zsh-theme
POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true
Config 7

true

You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/romkatv/powerlevel10k/issues/457?email_source=notifications&email_token=AJLCYCCTU3M565IUTZ5GOWDRBAXXVA5CNFSM4KPEZEB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKUGBII#issuecomment-581460129, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJLCYCEVZAX6MHJBOX7K423RBAXXVANCNFSM4KPEZEBQ.

Let's try one more. Does this work or hang?

export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="/Users/rblount/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true
plugins=()
source $ZSH/oh-my-zsh.sh

Also please do the following. Start zsh with a config where it hangs. When prompt appears, type echo hello and press ENTER. Take a screenshot and post it here. (You can drag and drop images to this edit box, and even copy-paste images.)

Screen Shot 2020-02-03 at 11 43 37 AM

And, running the individual commands you gave me seems to work fine. I don't get the issue right after running the commands

This is starting to get interesting. By the way, I should've mentioned that I cannot reproduce this on my machine with the same configuration as yours, that's why we are engaging in this remote debugging session.

Please do the following.

  1. Use Config 4.
  2. Open a terminal tab as usual. Press Ctrl-C to get to shell.
  3. Type exec zsh -x 2>/tmp/p10k.log.
  4. When prompt appears, type echo hello and hit enter.
  5. Without doing anything else, attach /tmp/p10k.log to this issue.

Thanks for working with me on this. I agree this is a very weird bug.
p10k.log

Just so we are clear, this issue appears AFTER the first prompt appears. So, open terminal, p10k prompt appears without issue. Issue any command, system hangs until I type ctrl-c and get the next prompt. After that the terminal works fine.

(Correction, hitting enter works fine at the first prompt, only issuing a command causes the terminal to stall.)

The logs once again indicate no hanging. Are you sure zsh was hanging when you grabbed /tmp/p10k.log? Could you double check it?

  1. Use Config 4.
  2. Open a terminal tab as usual. Type echo hello to make it hang. Press Ctrl-C to unhang.
  3. Type exec zsh -x 2>/tmp/p10k.log.
  4. When prompt appears, type echo hello.
  5. At this point zsh should be hanging. Type echo hello and hit enter once again.
  6. Without doing anything else, take a screenshot and attach /tmp/p10k.log to this issue.

I think we also had a bit of miscommunication earlier. Just in case, let's repeat one experiment.

  1. Use this content as ~/.zshrc:
export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="/Users/rblount/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true
plugins=()
source $ZSH/oh-my-zsh.sh
  1. Open a terminal tab as usual.
  2. Type echo hello and hit enter.
  3. Does it hang?

Please attach your ~/.p10k.zsh and run a few more experiment and report which ones hang.

Config 8

export ZSH="/Users/rblount/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=()
source $ZSH/oh-my-zsh.sh
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

Config 4 (clean room)

  1. Get to a working zsh.
  2. Run this command:
(
  emulate -L zsh
  setopt no_unset err_return
  local tmp && tmp="$(mktemp -d ${TMPDIR:-/tmp}/p10k.XXXXXXXXXX)"
  {
    cd $tmp
    git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git .oh-my-zsh
    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git .oh-my-zsh/custom/themes/powerlevel10k
    cat >.zshrc <<\END
export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH=$ZDOTDIR/.oh-my-zsh
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=()
source $ZSH/oh-my-zsh.sh
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
END
    ZDOTDIR=$tmp zsh
  } always {
    cd || true
    rm -rf $tmp
  }
)
  1. When prompt appears, type echo hello.
  2. Does it hang?

Thanks for working with my on this Roman.

I have a few things to work on this morning, but will follow-up later today.

-Rob

On Feb 4, 2020, at 3:18 AM, Roman Perepelitsa notifications@github.com wrote:

Please attach your ~/.p10k.zsh and run a few more experiment and report which ones hang.

Config 8

export ZSH="/Users/rblount/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=()
source $ZSH/oh-my-zsh.sh
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
Config 4 (clean room)

Get to a working zsh.
Run this command:
(
emulate -L zsh
setopt no_unset err_return
local tmp && tmp="$(mktemp -d ${TMPDIR:-/tmp}/p10k.XXXXXXXXXX)"
{
cd $tmp
git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git .oh-my-zsh
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git .oh-my-zsh/custom/themes/powerlevel10k
cat >.zshrc < export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH=$ZDOTDIR/.oh-my-zsh
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=()
source $ZSH/oh-my-zsh.sh
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
END
ZDOTDIR=$tmp zsh
} always {
cd || true
rm -rf $tmp
}
)
When prompt appears, type echo hello.
Does it hang?

You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/romkatv/powerlevel10k/issues/457?email_source=notifications&email_token=AJLCYCBZQTQJ5IQ7S4FYUPDRBEXGBA5CNFSM4KPEZEB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKW4NHA#issuecomment-581813916, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJLCYCEEPIKV6J7ZIR4NFJLRBEXGBANCNFSM4KPEZEBQ.

I ran a bunch of experiments myself and managed to reproduce this. It's a good thing that I did because it turns out we had serious miscommunication. The simplest way to reproduce from zsh -df:

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /tmp/powerlevel10k
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)
source /tmp/powerlevel10k/powerlevel10k.zsh-theme

After this zsh will hang on the first command that forks. echo hello doesn't hang it but =echo hello does. The simplest command to hang zsh is ().

The root cause is a bug in Zsh. It triggers in the following case:

  1. Zsh has been compiled with HAVE_SELECT and without HAVE_POLL.
  2. sysread is called with timeout (-t).
  3. The input file descriptor is valid but there is no data to read.
  4. errno happens to be EINTR prior to the call to sysread.

This results in an infinite loop in sysread:

while ((ret = select(infd+1, (SELECT_ARG_2_T) &fds,
                     NULL, NULL,&select_tv)) < 1) {
  if (errno != EINTR || errflag || retflag || breaks || contflag)
    break;
}

Here select keeps returning 0, indicating timeout. This is not an error, so errno doesn't get set. If it was EINTR prior to the call, it stays EINTR, and the loop keeps spinning.

As a workaround, powerlevel10k now sets errno to ENOTTY (any value other than EINTR would do) prior to calling sysread with timeout.

Please update powerlevel10k and check whether it's working for you now. I'll send a patch to fix the upstream bug in Zsh shortly.

Thanks for the update. I have pull the latest version and confirm the issued has been resolved.

Thanks for working with me on this. Glad that you were able to reproduce the bug and put in a work around until the bug can be fixed in ZSH.

On Feb 5, 2020, at 7:54 AM, Roman Perepelitsa notifications@github.com wrote:

I ran a bunch of experiments myself and managed to reproduce this. It's a good thing that I did because it turns out we serious miscommunication. The simplest way to reproduce from zsh -df:

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /tmp/powerlevel10k
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)
source /tmp/powerlevel10k/powerlevel10k.zsh-theme
After this zsh will hang on the first command that forks. echo hello doesn't hang it but =echo hello does. The simplest command to hang zsh is ().

The root cause is a bug in Zsh. It triggers in the following case:

Zsh has been compiled with HAVE_SELECT and without HAVE_POLL.
sysread is called with timeout (-t).
The input file descriptor is valid but there is no data to read.
errno happens to be EINTR prior to the call to sysread.
This results in an infinite loop in sysread:

while ((ret = select(infd+1, (SELECT_ARG_2_T) &fds,
NULL, NULL,&select_tv)) < 1) {
if (errno != EINTR || errflag || retflag || breaks || contflag)
break;
}
Here select keeps returning 0, indicating timeout. This is not an error, so errno doesn't get set. If it was EINTR prior to the call, it stays EINTR, and the loop keeps spinning.

As a workaround, powerlevel10k now sets errno to ENOTTY (any value other than EINTR would do) prior to calling sysread with timeout.

Please update powerlevel10k and check whether it's working for you now. I'll send a patch to fix the upstream bug in Zsh shortly.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/romkatv/powerlevel10k/issues/457?email_source=notifications&email_token=AJLCYCBDE3XRL6HJASYYIT3RBLAJFA5CNFSM4KPEZEB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEK3P4VA#issuecomment-582418004, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJLCYCAYB75G544MF7IHLMDRBLAJFANCNFSM4KPEZEBQ.

Thanks for reporting the bug, assisting with debugging and verifying the fix. Couldn't have fixed it without your help.

For the record, here's the patch I sent for the bug in Zsh: https://www.zsh.org/mla/workers//2020/msg00207.html. Will commit in a few days unless someone on the Zsh mailing list objects.

For the record, here's the patch I sent for the bug in Zsh: https://www.zsh.org/mla/workers//2020/msg00207.html. Will commit in a few days unless someone on the Zsh mailing list objects.

The patch has been merged (https://github.com/zsh-users/zsh/commit/754fdc6580192e81ecc0628349102308868b4857). This happened before zsh 5.8 release was cut. This is good -- zsh 5.8 won't have this bug.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zemuldo picture zemuldo  ·  4Comments

stevenguh picture stevenguh  ·  6Comments

gibfahn picture gibfahn  ·  5Comments

dylanjm picture dylanjm  ·  3Comments

georgijd picture georgijd  ·  3Comments