romkatv / gitstatus

Git status for Bash and Zsh prompt
GNU General Public License v3.0
1.69k stars 105 forks source link

gitstatus failed to initialize (OSX) #54

Closed omarbaza closed 5 years ago

omarbaza commented 5 years ago

This happens half the time.. sometimes it works, sometimes it doesn't.

GITSTATUS_LOG_LEVEL=DEBUG gitstatus_start -s -1 -u -1 -d -1 -c -1 -m -1 POWERLEVEL9K [ERROR]: gitstatus failed to initialize.

Your git prompt may disappear or become slow.

The content of /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.xtrace.WOBCxZr9jZ (gitstatus_start_impl xtrace):

+gitstatus_start_impl:11> local os
+gitstatus_start_impl:11> os=+gitstatus_start_impl:11> uname -s
+gitstatus_start_impl:11> os=Darwin
+gitstatus_start_impl:11> [[ -n Darwin ]]
+gitstatus_start_impl:12> [[ Darwin != Linux ]]
+gitstatus_start_impl:13> local arch
+gitstatus_start_impl:13> arch=+gitstatus_start_impl:13> uname -m
+gitstatus_start_impl:13> arch=x86_64
+gitstatus_start_impl:13> [[ -n x86_64 ]]
+gitstatus_start_impl:15> local daemon=/Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64
+gitstatus_start_impl:16> [[ -f /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 ]]
+gitstatus_start_impl:18> lock_file=+gitstatus_start_impl:18> mktemp /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.lock.XXXXXXXXXX
+gitstatus_start_impl:18> lock_file=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.lock.LjUDkystN9
+gitstatus_start_impl:19> zsystem flock -f lock_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.lock.LjUDkystN9
+gitstatus_start_impl:21> req_fifo=+gitstatus_start_impl:21> mktemp -u /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.pipe.req.XXXXXXXXXX
+gitstatus_start_impl:21> req_fifo=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.pipe.req.PGBH3AX3nW
+gitstatus_start_impl:22> mkfifo /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.pipe.req.PGBH3AX3nW
+gitstatus_start_impl:24> resp_fifo=+gitstatus_start_impl:24> mktemp -u /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.pipe.resp.XXXXXXXXXX
+gitstatus_start_impl:24> resp_fifo=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.pipe.resp.q1comaOLTb
+gitstatus_start_impl:25> mkfifo /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.pipe.resp.q1comaOLTb
+gitstatus_start_impl:27> [[ -n DEBUG ]]
+gitstatus_start_impl:28> log_file=+gitstatus_start_impl:28> mktemp /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.daemon-log.XXXXXXXXXX
+gitstatus_start_impl:28> log_file=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.daemon-log.ij6ADxvMJZ
+gitstatus_start_impl:30> typeset -g 'GITSTATUS_DAEMON_LOG_POWERLEVEL9K=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.daemon-log.ij6ADxvMJZ'
+gitstatus_start_impl:32> local -i threads=0
+gitstatus_start_impl:33> ((  threads > 0 ))
+gitstatus_start_impl:34> threads=8
+gitstatus_start_impl:35> case Darwin (FreeBSD)
+gitstatus_start_impl:35> case Darwin (*)
+gitstatus_start_impl:37> ((  ! 1  ))
+gitstatus_start_impl:37> threads=+gitstatus_start_impl:37> getconf _NPROCESSORS_ONLN
+gitstatus_start_impl:37> threads=8
+gitstatus_start_impl:39> ((  threads <= 32  ))
+gitstatus_start_impl:42> local -a daemon_args=( '--lock-fd=3' '--parent-pid=27758' '--num-threads=8' '--max-num-staged=-1' '--max-num-unstaged=-1' '--max-num-conflicted=-1' '--max-num-untracked=-1' '--dirty-max-index-size=-1' '--log-level=DEBUG' )
+gitstatus_start_impl:53> local cmd=$'\n      echo $$\n      /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 --lock-fd=3 --parent-pid=27758 --num-threads=8 --max-num-staged=-1 --max-num-unstaged=-1 --max-num-conflicted=-1 --max-num-untracked=-1 --dirty-max-index-size=-1 --log-level=DEBUG\n      if [[ $? != (0|10) && $? -le 128 &&\n            -z \'\' &&\n            -f /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static ]]; then\n        /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static --lock-fd=3 --parent-pid=27758 --num-threads=8 --max-num-staged=-1 --max-num-unstaged=-1 --max-num-conflicted=-1 --max-num-untracked=-1 --dirty-max-index-size=-1 --log-level=DEBUG\n      fi\n      echo -nE $\'bye\\x1f0\\x1e\''
+gitstatus_start_impl:62> local setsid=/usr/local/opt/util-linux/bin/setsid
+gitstatus_start_impl:63> [[ -f /usr/local/opt/util-linux/bin/setsid ]]
+gitstatus_start_impl:63> setsid=''
+gitstatus_start_impl:64> cmd='cd /;  zsh -dfxc $'\''\n'\''\ \ \ \ \ \ echo\ \$\$$'\''\n'\''\ \ \ \ \ \ /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64\ --lock-fd=3\ --parent-pid=27758\ --num-threads=8\ --max-num-staged=-1\ --max-num-unstaged=-1\ --max-num-conflicted=-1\ --max-num-untracked=-1\ --dirty-max-index-size=-1\ --log-level=DEBUG$'\''\n'\''\ \ \ \ \ \ if\ \[\[\ \$\?\ \!=\ \(0\|10\)\ \&\&\ \$\?\ -le\ 128\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -z\ \'\''\'\''\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -f\ /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ \]\]\;\ then$'\''\n'\''\ \ \ \ \ \ \ \ /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ --lock-fd=3\ --parent-pid=27758\ --num-threads=8\ --max-num-staged=-1\ --max-num-unstaged=-1\ --max-num-conflicted=-1\ --max-num-untracked=-1\ --dirty-max-index-size=-1\ --log-level=DEBUG$'\''\n'\''\ \ \ \ \ \ fi$'\''\n'\''\ \ \ \ \ \ echo\ -nE\ \$\'\''bye\\x1f0\\x1e\'\'' &!'
+gitstatus_start_impl:73> sysopen -w -o cloexec,sync -u req_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.pipe.req.PGBH3AX3nW
+gitstatus_start_impl:74> sysopen -r -o cloexec -u resp_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.pipe.resp.q1comaOLTb
+gitstatus_start_impl:76> read -u 15 daemon_pid
+gitstatus_start_impl:71> zsh -dfmxc 'cd /;  zsh -dfxc $'\''\n'\''\ \ \ \ \ \ echo\ \$\$$'\''\n'\''\ \ \ \ \ \ /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64\ --lock-fd=3\ --parent-pid=27758\ --num-threads=8\ --max-num-staged=-1\ --max-num-unstaged=-1\ --max-num-conflicted=-1\ --max-num-untracked=-1\ --dirty-max-index-size=-1\ --log-level=DEBUG$'\''\n'\''\ \ \ \ \ \ if\ \[\[\ \$\?\ \!=\ \(0\|10\)\ \&\&\ \$\?\ -le\ 128\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -z\ \'\''\'\''\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -f\ /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ \]\]\;\ then$'\''\n'\''\ \ \ \ \ \ \ \ /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ --lock-fd=3\ --parent-pid=27758\ --num-threads=8\ --max-num-staged=-1\ --max-num-unstaged=-1\ --max-num-conflicted=-1\ --max-num-untracked=-1\ --dirty-max-index-size=-1\ --log-level=DEBUG$'\''\n'\''\ \ \ \ \ \ fi$'\''\n'\''\ \ \ \ \ \ echo\ -nE\ \$\'\''bye\\x1f0\\x1e\'\'' &!'
+gitstatus_start_impl:78> rm -f /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.pipe.req.PGBH3AX3nW /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.pipe.resp.q1comaOLTb /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.lock.LjUDkystN9
+gitstatus_start_impl:89> zle -F 15 _gitstatus_process_response_POWERLEVEL9K
+gitstatus_start_impl:91> local reply IFS=''
+gitstatus_start_impl:92> echo -nE $'hello\C-_\C-^'
+gitstatus_start_impl:93> read -r -d $'\C-^' -u 15 -t 5.0000000000 reply
                           ^ this command failed

The content of /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.27758.daemon-log.ij6ADxvMJZ (gitstatus daemon log):

+zsh:1> cd /
+zsh:1> zsh -dfxc $'\n      echo $$\n      /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 --lock-fd=3 --parent-pid=27758 --num-threads=8 --max-num-staged=-1 --max-num-unstaged=-1 --max-num-conflicted=-1 --max-num-untracked=-1 --dirty-max-index-size=-1 --log-level=DEBUG\n      if [[ $? != (0|10) && $? -le 128 &&\n            -z \'\' &&\n            -f /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static ]]; then\n        /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static --lock-fd=3 --parent-pid=27758 --num-threads=8 --max-num-staged=-1 --max-num-unstaged=-1 --max-num-conflicted=-1 --max-num-untracked=-1 --dirty-max-index-size=-1 --log-level=DEBUG\n      fi\n      echo -nE $\'bye\\x1f0\\x1e\''
+zsh:2> echo 27814
+zsh:3> /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 '--lock-fd=3' '--parent-pid=27758' '--num-threads=8' '--max-num-staged=-1' '--max-num-unstaged=-1' '--max-num-conflicted=-1' '--max-num-untracked=-1' '--dirty-max-index-size=-1' '--log-level=DEBUG'
[2019-08-10 00:38:04 000000011b5d85c0 INFO src/gitstatus.cc:157] argv[0]: "/Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64"
[2019-08-10 00:38:04 000000011b5d85c0 INFO src/gitstatus.cc:157] argv[1]: "--lock-fd=3"
[2019-08-10 00:38:04 000000011b5d85c0 INFO src/gitstatus.cc:157] argv[2]: "--parent-pid=27758"
[2019-08-10 00:38:04 000000011b5d85c0 INFO src/gitstatus.cc:157] argv[3]: "--num-threads=8"
[2019-08-10 00:38:04 000000011b5d85c0 INFO src/gitstatus.cc:157] argv[4]: "--max-num-staged=-1"
[2019-08-10 00:38:04 000000011b5d85c0 INFO src/gitstatus.cc:157] argv[5]: "--max-num-unstaged=-1"
[2019-08-10 00:38:04 000000011b5d85c0 INFO src/gitstatus.cc:157] argv[6]: "--max-num-conflicted=-1"
[2019-08-10 00:38:04 000000011b5d85c0 INFO src/gitstatus.cc:157] argv[7]: "--max-num-untracked=-1"
[2019-08-10 00:38:04 000000011b5d85c0 INFO src/gitstatus.cc:157] argv[8]: "--dirty-max-index-size=-1"
[2019-08-10 00:38:04 000000011b5d85c0 INFO src/gitstatus.cc:157] argv[9]: "--log-level=DEBUG"
[2019-08-10 00:38:04 000000011b5d85c0 INFO src/thread_pool.cc:81] Spawning 8 thread(s)
[2019-08-10 00:38:09 000000011b5d85c0 INFO src/request.cc:110] EOF. Exiting.

Your system information:

zsh:      5.7.1
uname -a: Darwin c4b301d3c8fd.ant.amazon.com 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64

If you need help, open an issue and attach this whole error message to it:

https://github.com/romkatv/gitstatus/issues/new
romkatv commented 5 years ago

Can you reproduce this with all plugins disabled? For example, do you get this error when executing the following command?

(
  emulate -L zsh
  setopt err_return no_unset
  local tmp && tmp=$(mktemp -d "${TMPDIR:-/tmp}"/p10k.XXXXXXXXXX)
  {
    cd $tmp
    git clone --depth 1 https://github.com/romkatv/powerlevel10k.git
    echo "source ${(q)tmp}/powerlevel10k/powerlevel10k.zsh-theme" >>$tmp/.zshrc
    ZDOTDIR=$tmp POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true zsh -d
  } always {
    cd || true
    rm -rf $tmp
  }
)
omarbaza commented 5 years ago

I just installed zsh, oh my zsh and powerlevel10k.

I got this (after executing the code you posted):

Cloning into 'powerlevel10k'... remote: Enumerating objects: 39, done. remote: Counting objects: 100% (39/39), done. remote: Compressing objects: 100% (34/34), done. remote: Total 39 (delta 1), reused 16 (delta 0), pack-reused 0 Unpacking objects: 100% (39/39), done. [ERROR]: gitstatus failed to initialize.

Your git prompt may disappear or become slow.

Run the following command to retry with extra diagnostics:

omarbaza@c4b301d3c8fd  /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.EC3S1V93cO 

omarbaza commented 5 years ago

from my config file, the only plugin I have is git:

# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
romkatv commented 5 years ago

from my config file, the only plugin I have is git:

This doesn't matter as you were able to reproduce this problem when none of your config files are sourced.

Is there anything unusual about your system?

What is the output of zsh --version?

Can you reproduce this after running brew install util-linux?

omarbaza commented 5 years ago

I installed a newer version of zsh using brew:

zsh --version zsh 5.7.1 (x86_64-apple-darwin18.2.0)

I ran it after running the brew install util-linux, same errors.

Last login: Sat Aug 10 01:36:19 on ttys000 [ERROR]: gitstatus failed to initialize.

Your git prompt may disappear or become slow.

Run the following command to retry with extra diagnostics:

GITSTATUS_LOG_LEVEL=DEBUG gitstatus_start -s -1 -u -1 -d -1 -c -1 -m -1 POWERLEVEL9K

I did NOT did the "echo 'export PATH="/usr/local/opt/util-linux/sbin:$PATH"' >> ~/.zshrc"

omarbaza commented 5 years ago

Last login: Sat Aug 10 01:38:34 on ttys000 [ERROR]: gitstatus failed to initialize.

Your git prompt may disappear or become slow.

Run the following command to retry with extra diagnostics:

GITSTATUS_LOG_LEVEL=DEBUG gitstatus_start -s -1 -u -1 -d -1 -c -1 -m -1 POWERLEVEL9K

   ~  GITSTATUS_LOG_LEVEL=DEBUG gitstatus_start -s -1 -u -1 -d -1 -c -1 -m -1 POWERLEVEL9K [ERROR]: gitstatus failed to initialize.

Your git prompt may disappear or become slow.

The content of /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.xtrace.ZGIjLsYwUX (gitstatus_start_impl xtrace):

+gitstatus_start_impl:11> local os
+gitstatus_start_impl:11> os=+gitstatus_start_impl:11> uname -s
+gitstatus_start_impl:11> os=Darwin
+gitstatus_start_impl:11> [[ -n Darwin ]]
+gitstatus_start_impl:12> [[ Darwin != Linux ]]
+gitstatus_start_impl:13> local arch
+gitstatus_start_impl:13> arch=+gitstatus_start_impl:13> uname -m
+gitstatus_start_impl:13> arch=x86_64
+gitstatus_start_impl:13> [[ -n x86_64 ]]
+gitstatus_start_impl:15> local daemon=/Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64
+gitstatus_start_impl:16> [[ -f /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 ]]
+gitstatus_start_impl:18> lock_file=+gitstatus_start_impl:18> mktemp /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.lock.XXXXXXXXXX
+gitstatus_start_impl:18> lock_file=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.lock.CsF0scTkf8
+gitstatus_start_impl:19> zsystem flock -f lock_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.lock.CsF0scTkf8
+gitstatus_start_impl:21> req_fifo=+gitstatus_start_impl:21> mktemp -u /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.pipe.req.XXXXXXXXXX
+gitstatus_start_impl:21> req_fifo=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.pipe.req.wG6ZqbWX3R
+gitstatus_start_impl:22> mkfifo /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.pipe.req.wG6ZqbWX3R
+gitstatus_start_impl:24> resp_fifo=+gitstatus_start_impl:24> mktemp -u /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.pipe.resp.XXXXXXXXXX
+gitstatus_start_impl:24> resp_fifo=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.pipe.resp.KGG8c3BzDm
+gitstatus_start_impl:25> mkfifo /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.pipe.resp.KGG8c3BzDm
+gitstatus_start_impl:27> [[ -n DEBUG ]]
+gitstatus_start_impl:28> log_file=+gitstatus_start_impl:28> mktemp /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.daemon-log.XXXXXXXXXX
+gitstatus_start_impl:28> log_file=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.daemon-log.wDjm4Yjeem
+gitstatus_start_impl:30> typeset -g 'GITSTATUS_DAEMON_LOG_POWERLEVEL9K=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.daemon-log.wDjm4Yjeem'
+gitstatus_start_impl:32> local -i threads=0
+gitstatus_start_impl:33> ((  threads > 0 ))
+gitstatus_start_impl:34> threads=8
+gitstatus_start_impl:35> case Darwin (FreeBSD)
+gitstatus_start_impl:35> case Darwin (*)
+gitstatus_start_impl:37> ((  ! 1  ))
+gitstatus_start_impl:37> threads=+gitstatus_start_impl:37> getconf _NPROCESSORS_ONLN
+gitstatus_start_impl:37> threads=8
+gitstatus_start_impl:39> ((  threads <= 32  ))
+gitstatus_start_impl:42> local -a daemon_args=( '--lock-fd=3' '--parent-pid=31792' '--num-threads=8' '--max-num-staged=-1' '--max-num-unstaged=-1' '--max-num-conflicted=-1' '--max-num-untracked=-1' '--dirty-max-index-size=-1' '--log-level=DEBUG' )
+gitstatus_start_impl:53> local cmd=$'\n      echo $$\n      /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 --lock-fd=3 --parent-pid=31792 --num-threads=8 --max-num-staged=-1 --max-num-unstaged=-1 --max-num-conflicted=-1 --max-num-untracked=-1 --dirty-max-index-size=-1 --log-level=DEBUG\n      if [[ $? != (0|10) && $? -le 128 &&\n            -z \'\' &&\n            -f /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static ]]; then\n        /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static --lock-fd=3 --parent-pid=31792 --num-threads=8 --max-num-staged=-1 --max-num-unstaged=-1 --max-num-conflicted=-1 --max-num-untracked=-1 --dirty-max-index-size=-1 --log-level=DEBUG\n      fi\n      echo -nE $\'bye\\x1f0\\x1e\''
+gitstatus_start_impl:62> local setsid=/usr/local/opt/util-linux/bin/setsid
+gitstatus_start_impl:63> [[ -f /usr/local/opt/util-linux/bin/setsid ]]
+gitstatus_start_impl:63> setsid=/usr/local/opt/util-linux/bin/setsid
+gitstatus_start_impl:64> cmd='cd /; /usr/local/opt/util-linux/bin/setsid zsh -dfxc $'\''\n'\''\ \ \ \ \ \ echo\ \$\$$'\''\n'\''\ \ \ \ \ \ /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64\ --lock-fd=3\ --parent-pid=31792\ --num-threads=8\ --max-num-staged=-1\ --max-num-unstaged=-1\ --max-num-conflicted=-1\ --max-num-untracked=-1\ --dirty-max-index-size=-1\ --log-level=DEBUG$'\''\n'\''\ \ \ \ \ \ if\ \[\[\ \$\?\ \!=\ \(0\|10\)\ \&\&\ \$\?\ -le\ 128\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -z\ \'\''\'\''\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -f\ /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ \]\]\;\ then$'\''\n'\''\ \ \ \ \ \ \ \ /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ --lock-fd=3\ --parent-pid=31792\ --num-threads=8\ --max-num-staged=-1\ --max-num-unstaged=-1\ --max-num-conflicted=-1\ --max-num-untracked=-1\ --dirty-max-index-size=-1\ --log-level=DEBUG$'\''\n'\''\ \ \ \ \ \ fi$'\''\n'\''\ \ \ \ \ \ echo\ -nE\ \$\'\''bye\\x1f0\\x1e\'\'' &!'
+gitstatus_start_impl:73> sysopen -w -o cloexec,sync -u req_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.pipe.req.wG6ZqbWX3R
+gitstatus_start_impl:74> sysopen -r -o cloexec -u resp_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.pipe.resp.KGG8c3BzDm
+gitstatus_start_impl:76> read -u 15 daemon_pid
+gitstatus_start_impl:71> zsh -dfmxc 'cd /; /usr/local/opt/util-linux/bin/setsid zsh -dfxc $'\''\n'\''\ \ \ \ \ \ echo\ \$\$$'\''\n'\''\ \ \ \ \ \ /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64\ --lock-fd=3\ --parent-pid=31792\ --num-threads=8\ --max-num-staged=-1\ --max-num-unstaged=-1\ --max-num-conflicted=-1\ --max-num-untracked=-1\ --dirty-max-index-size=-1\ --log-level=DEBUG$'\''\n'\''\ \ \ \ \ \ if\ \[\[\ \$\?\ \!=\ \(0\|10\)\ \&\&\ \$\?\ -le\ 128\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -z\ \'\''\'\''\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -f\ /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ \]\]\;\ then$'\''\n'\''\ \ \ \ \ \ \ \ /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ --lock-fd=3\ --parent-pid=31792\ --num-threads=8\ --max-num-staged=-1\ --max-num-unstaged=-1\ --max-num-conflicted=-1\ --max-num-untracked=-1\ --dirty-max-index-size=-1\ --log-level=DEBUG$'\''\n'\''\ \ \ \ \ \ fi$'\''\n'\''\ \ \ \ \ \ echo\ -nE\ \$\'\''bye\\x1f0\\x1e\'\'' &!'
+gitstatus_start_impl:78> rm -f /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.pipe.req.wG6ZqbWX3R /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.pipe.resp.KGG8c3BzDm /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.lock.CsF0scTkf8
+gitstatus_start_impl:89> zle -F 15 _gitstatus_process_response_POWERLEVEL9K
+gitstatus_start_impl:91> local reply IFS=''
+gitstatus_start_impl:92> echo -nE $'hello\C-_\C-^'
+gitstatus_start_impl:93> read -r -d $'\C-^' -u 15 -t 5.0000000000 reply
                           ^ this command failed

The content of /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.31792.daemon-log.wDjm4Yjeem (gitstatus daemon log):

+zsh:1> cd /
+zsh:1> /usr/local/opt/util-linux/bin/setsid zsh -dfxc $'\n      echo $$\n      /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 --lock-fd=3 --parent-pid=31792 --num-threads=8 --max-num-staged=-1 --max-num-unstaged=-1 --max-num-conflicted=-1 --max-num-untracked=-1 --dirty-max-index-size=-1 --log-level=DEBUG\n      if [[ $? != (0|10) && $? -le 128 &&\n            -z \'\' &&\n            -f /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static ]]; then\n        /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static --lock-fd=3 --parent-pid=31792 --num-threads=8 --max-num-staged=-1 --max-num-unstaged=-1 --max-num-conflicted=-1 --max-num-untracked=-1 --dirty-max-index-size=-1 --log-level=DEBUG\n      fi\n      echo -nE $\'bye\\x1f0\\x1e\''
+zsh:2> echo 31894
+zsh:3> /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 '--lock-fd=3' '--parent-pid=31792' '--num-threads=8' '--max-num-staged=-1' '--max-num-unstaged=-1' '--max-num-conflicted=-1' '--max-num-untracked=-1' '--dirty-max-index-size=-1' '--log-level=DEBUG'
[2019-08-10 01:39:07 00000001119b75c0 INFO src/gitstatus.cc:157] argv[0]: "/Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64"
[2019-08-10 01:39:07 00000001119b75c0 INFO src/gitstatus.cc:157] argv[1]: "--lock-fd=3"
[2019-08-10 01:39:07 00000001119b75c0 INFO src/gitstatus.cc:157] argv[2]: "--parent-pid=31792"
[2019-08-10 01:39:07 00000001119b75c0 INFO src/gitstatus.cc:157] argv[3]: "--num-threads=8"
[2019-08-10 01:39:07 00000001119b75c0 INFO src/gitstatus.cc:157] argv[4]: "--max-num-staged=-1"
[2019-08-10 01:39:07 00000001119b75c0 INFO src/gitstatus.cc:157] argv[5]: "--max-num-unstaged=-1"
[2019-08-10 01:39:07 00000001119b75c0 INFO src/gitstatus.cc:157] argv[6]: "--max-num-conflicted=-1"
[2019-08-10 01:39:07 00000001119b75c0 INFO src/gitstatus.cc:157] argv[7]: "--max-num-untracked=-1"
[2019-08-10 01:39:07 00000001119b75c0 INFO src/gitstatus.cc:157] argv[8]: "--dirty-max-index-size=-1"
[2019-08-10 01:39:07 00000001119b75c0 INFO src/gitstatus.cc:157] argv[9]: "--log-level=DEBUG"
[2019-08-10 01:39:07 00000001119b75c0 INFO src/thread_pool.cc:81] Spawning 8 thread(s)
[2019-08-10 01:39:12 00000001119b75c0 INFO src/request.cc:110] EOF. Exiting.

Your system information:

zsh:      5.7.1
uname -a: Darwin c4b301d3c8fd.ant.amazon.com 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64

If you need help, open an issue and attach this whole error message to it:

https://github.com/romkatv/gitstatus/issues/new

   ~ 

omarbaza commented 5 years ago

More logs:

+gitstatus_start_impl:93> read -r -d $'\C-^' -u 15 -t 5.0000000000 reply
                           ^ this command failed

The content of /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.32603.daemon-log.BsaOlgvWwT (gitstatus daemon log):

+zsh:1> cd /
+zsh:1> /usr/local/opt/util-linux/bin/setsid zsh -dfxc $'\n      echo $$\n      /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 --lock-fd=3 --parent-pid=32603 --num-threads=8 --max-num-staged=-1 --max-num-unstaged=-1 --max-num-conflicted=-1 --max-num-untracked=-1 --dirty-max-index-size=-1 --log-level=DEBUG\n      if [[ $? != (0|10) && $? -le 128 &&\n            -z \'\' &&\n            -f /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static ]]; then\n        /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static --lock-fd=3 --parent-pid=32603 --num-threads=8 --max-num-staged=-1 --max-num-unstaged=-1 --max-num-conflicted=-1 --max-num-untracked=-1 --dirty-max-index-size=-1 --log-level=DEBUG\n      fi\n      echo -nE $\'bye\\x1f0\\x1e\''
+zsh:2> echo 32662
+zsh:3> /Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 '--lock-fd=3' '--parent-pid=32603' '--num-threads=8' '--max-num-staged=-1' '--max-num-unstaged=-1' '--max-num-conflicted=-1' '--max-num-untracked=-1' '--dirty-max-index-size=-1' '--log-level=DEBUG'
[2019-08-10 01:51:39 0000000118ca75c0 INFO src/gitstatus.cc:157] argv[0]: "/Users/omarbaza/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64"
[2019-08-10 01:51:39 0000000118ca75c0 INFO src/gitstatus.cc:157] argv[1]: "--lock-fd=3"
[2019-08-10 01:51:39 0000000118ca75c0 INFO src/gitstatus.cc:157] argv[2]: "--parent-pid=32603"
[2019-08-10 01:51:39 0000000118ca75c0 INFO src/gitstatus.cc:157] argv[3]: "--num-threads=8"
[2019-08-10 01:51:39 0000000118ca75c0 INFO src/gitstatus.cc:157] argv[4]: "--max-num-staged=-1"
[2019-08-10 01:51:39 0000000118ca75c0 INFO src/gitstatus.cc:157] argv[5]: "--max-num-unstaged=-1"
[2019-08-10 01:51:39 0000000118ca75c0 INFO src/gitstatus.cc:157] argv[6]: "--max-num-conflicted=-1"
[2019-08-10 01:51:39 0000000118ca75c0 INFO src/gitstatus.cc:157] argv[7]: "--max-num-untracked=-1"
[2019-08-10 01:51:39 0000000118ca75c0 INFO src/gitstatus.cc:157] argv[8]: "--dirty-max-index-size=-1"
[2019-08-10 01:51:39 0000000118ca75c0 INFO src/gitstatus.cc:157] argv[9]: "--log-level=DEBUG"
[2019-08-10 01:51:39 0000000118ca75c0 INFO src/thread_pool.cc:81] Spawning 8 thread(s)
[2019-08-10 01:51:44 0000000118ca75c0 INFO src/request.cc:110] EOF. Exiting.
romkatv commented 5 years ago

I did NOT did the "echo 'export PATH="/usr/local/opt/util-linux/sbin:$PATH"' >> ~/.zshrc"

That's fine. gitstatus can find it. It doesn't help though.

Is there anything unusual about your system? Some non-default filesystem? Antivirus software? The whole thing is a VM? Some sandboxed environment?

Basically, you are the first person to encounter this error. If I could figure out how to reproduce, I'll likely be able to fix it quickly. The other options is to engage in remote debugging where I send you commands and you send me responses. From past experience this is extremely time consuming for both of us so I'd like to avoid it.

romkatv commented 5 years ago

By the way, does it fail instantly or does it hang for 5 seconds before failing?

omarbaza commented 5 years ago

this happens more often when I just open iTerm2.

I open iTerm2, waits 3-5 seconds, and then I get this error.

romkatv commented 5 years ago

Would appreciate if you can answer questions from https://github.com/romkatv/gitstatus/issues/54#issuecomment-520131916.

omarbaza commented 5 years ago

I did NOT did the "echo 'export PATH="/usr/local/opt/util-linux/sbin:$PATH"' >> ~/.zshrc"

That's fine. gitstatus can find it. It doesn't help though.

Is there anything unusual about your system? Some non-default filesystem? Antivirus software? The whole thing is a VM? Some sandboxed environment?

Nope, is a mac 2015 with Mojave. Is from my work, but other themes / software work just fine.

Basically, you are the first person to encounter this error. If I could figure out how to reproduce, I'll likely be able to fix it quickly. The other options is to engage in remote debugging where I send you commands and you send me responses. From past experience this is extremely time consuming for both of us so I'd like to avoid it.

I can help running as many commands as you want. Hopefully you don;t need to do that

omarbaza commented 5 years ago

No antivirus, No sandbox, no weird filesystem, no VM, No sandbox, I can install everything I want (sudo and everything)

romkatv commented 5 years ago

I can help running as many commands as you want.

Thanks. It is more time consuming for me than for you though because I need to write the commands, push patched code, etc. Last time a similar issue took ~40 hours of my time.

Do you get the same error when using a different terminal?

this happens more often when I just open iTerm2.

When does it happen less often? When you open a new tab? When you type exec zsh?

omarbaza commented 5 years ago

I made some tests... issue happens no matter if I use terminal or exec zsh.

I just tried opening different panels in iTerm. Around 30% are failing this with this error opening a new panel every 2-3 seconds.

romkatv commented 5 years ago

OK, let's try the first experiment. See if you can reproduce the error with this:

(
  emulate -L zsh
  setopt err_return no_unset
  local tmp && tmp=$(mktemp -d "${TMPDIR:-/tmp}"/p10k.XXXXXXXXXX)
  {
    cd $tmp
    git clone -b dev --depth 1 https://github.com/romkatv/powerlevel10k.git
    echo "source ${(q)tmp}/powerlevel10k/powerlevel10k.zsh-theme" >>$tmp/.zshrc
    ZDOTDIR=$tmp POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true zsh -d
  } always {
    cd || true
    rm -rf $tmp
  }
)
omarbaza commented 5 years ago

Yes...

   ~  (  ✔ emulate -L zsh setopt err_return no_unset local tmp && tmp=$(mktemp -d "${TMPDIR:-/tmp}"/p10k.XXXXXXXXXX) { cd $tmp git clone -b dev --depth 1 https://github.com/romkatv/powerlevel10k.git echo "source ${(q)tmp}/powerlevel10k/powerlevel10k.zsh-theme" >>$tmp/.zshrc ZDOTDIR=$tmp POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true zsh -d } always { cd || true rm -rf $tmp } ) Cloning into 'powerlevel10k'... remote: Enumerating objects: 39, done. remote: Counting objects: 100% (39/39), done. remote: Compressing objects: 100% (34/34), done. remote: Total 39 (delta 1), reused 15 (delta 0), pack-reused 0 Unpacking objects: 100% (39/39), done. [ERROR]: gitstatus failed to initialize.

Your git prompt may disappear or become slow.

Run the following command to retry with extra diagnostics:

GITSTATUS_LOG_LEVEL=DEBUG gitstatus_start -s 1 -u 1 -d 1 -c 1 -m -1 POWERLEVEL9K

omarbaza@c4b301d3c8fd  /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.BKOunPRJJy  GITSTATUS_LOG_LEVEL=DEBUG gitstatus_start -s 1 -u 1 -d 1 -c 1 -m -1 POWERLEVEL9K [ERROR]: gitstatus failed to initialize.

Your git prompt may disappear or become slow.

The content of /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.xtrace.5NMr8iE9Gu (gitstatus_start_impl xtrace):

+gitstatus_start_impl:11> local os
+gitstatus_start_impl:11> os=+gitstatus_start_impl:11> uname -s
+gitstatus_start_impl:11> os=Darwin
+gitstatus_start_impl:11> [[ -n Darwin ]]
+gitstatus_start_impl:12> [[ Darwin != Linux ]]
+gitstatus_start_impl:13> local arch
+gitstatus_start_impl:13> arch=+gitstatus_start_impl:13> uname -m
+gitstatus_start_impl:13> arch=x86_64
+gitstatus_start_impl:13> [[ -n x86_64 ]]
+gitstatus_start_impl:15> local daemon=/private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.BKOunPRJJy/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64
+gitstatus_start_impl:16> [[ -f /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.BKOunPRJJy/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 ]]
+gitstatus_start_impl:18> lock_file=+gitstatus_start_impl:18> mktemp /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.lock.XXXXXXXXXX
+gitstatus_start_impl:18> lock_file=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.lock.HayprjlMUU
+gitstatus_start_impl:19> zsystem flock -f lock_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.lock.HayprjlMUU
+gitstatus_start_impl:21> req_fifo=+gitstatus_start_impl:21> mktemp -u /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.pipe.req.XXXXXXXXXX
+gitstatus_start_impl:21> req_fifo=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.pipe.req.yw8f0wTrco
+gitstatus_start_impl:22> mkfifo /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.pipe.req.yw8f0wTrco
+gitstatus_start_impl:24> resp_fifo=+gitstatus_start_impl:24> mktemp -u /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.pipe.resp.XXXXXXXXXX
+gitstatus_start_impl:24> resp_fifo=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.pipe.resp.Ru1c5TCA1w
+gitstatus_start_impl:25> mkfifo /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.pipe.resp.Ru1c5TCA1w
+gitstatus_start_impl:27> [[ -n DEBUG ]]
+gitstatus_start_impl:28> log_file=+gitstatus_start_impl:28> mktemp /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.daemon-log.XXXXXXXXXX
+gitstatus_start_impl:28> log_file=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.daemon-log.32lDA6J8hc
+gitstatus_start_impl:30> typeset -g 'GITSTATUS_DAEMON_LOG_POWERLEVEL9K=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.daemon-log.32lDA6J8hc'
+gitstatus_start_impl:32> local -i threads=0
+gitstatus_start_impl:33> ((  threads > 0 ))
+gitstatus_start_impl:34> threads=8
+gitstatus_start_impl:35> case Darwin (FreeBSD)
+gitstatus_start_impl:35> case Darwin (*)
+gitstatus_start_impl:37> ((  ! 1  ))
+gitstatus_start_impl:37> threads=+gitstatus_start_impl:37> getconf _NPROCESSORS_ONLN
+gitstatus_start_impl:37> threads=8
+gitstatus_start_impl:39> ((  threads <= 32  ))
+gitstatus_start_impl:42> local -a daemon_args=( '--lock-fd=3' '--parent-pid=54740' '--num-threads=8' '--max-num-staged=1' '--max-num-unstaged=1' '--max-num-conflicted=1' '--max-num-untracked=1' '--dirty-max-index-size=-1' '--log-level=DEBUG' )
+gitstatus_start_impl:53> local cmd=$'\n      exec </var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.pipe.req.yw8f0wTrco >/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.pipe.resp.Ru1c5TCA1w 2>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.daemon-log.32lDA6J8hc 3</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.lock.HayprjlMUU\n      echo $$\n      /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.BKOunPRJJy/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 --lock-fd=3 --parent-pid=54740 --num-threads=8 --max-num-staged=1 --max-num-unstaged=1 --max-num-conflicted=1 --max-num-untracked=1 --dirty-max-index-size=-1 --log-level=DEBUG\n      if [[ $? != (0|10) && $? -le 128 &&\n            -z \'\' &&\n            -f /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.BKOunPRJJy/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static ]]; then\n        /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.BKOunPRJJy/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static --lock-fd=3 --parent-pid=54740 --num-threads=8 --max-num-staged=1 --max-num-unstaged=1 --max-num-conflicted=1 --max-num-untracked=1 --dirty-max-index-size=-1 --log-level=DEBUG\n      fi\n      echo -nE $\'bye\\x1f0\\x1e\''
+gitstatus_start_impl:63> local setsid=/usr/local/opt/util-linux/bin/setsid
+gitstatus_start_impl:64> [[ -f /usr/local/opt/util-linux/bin/setsid ]]
+gitstatus_start_impl:64> setsid=/usr/local/opt/util-linux/bin/setsid
+gitstatus_start_impl:65> cmd='cd /; /usr/local/opt/util-linux/bin/setsid zsh -dfxc $'\''\n'\''\ \ \ \ \ \ exec\ \</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.pipe.req.yw8f0wTrco\ \>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.pipe.resp.Ru1c5TCA1w\ 2\>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.daemon-log.32lDA6J8hc\ 3\</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.lock.HayprjlMUU$'\''\n'\''\ \ \ \ \ \ echo\ \$\$$'\''\n'\''\ \ \ \ \ \ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.BKOunPRJJy/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64\ --lock-fd=3\ --parent-pid=54740\ --num-threads=8\ --max-num-staged=1\ --max-num-unstaged=1\ --max-num-conflicted=1\ --max-num-untracked=1\ --dirty-max-index-size=-1\ --log-level=DEBUG$'\''\n'\''\ \ \ \ \ \ if\ \[\[\ \$\?\ \!=\ \(0\|10\)\ \&\&\ \$\?\ -le\ 128\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -z\ \'\''\'\''\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -f\ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.BKOunPRJJy/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ \]\]\;\ then$'\''\n'\''\ \ \ \ \ \ \ \ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.BKOunPRJJy/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ --lock-fd=3\ --parent-pid=54740\ --num-threads=8\ --max-num-staged=1\ --max-num-unstaged=1\ --max-num-conflicted=1\ --max-num-untracked=1\ --dirty-max-index-size=-1\ --log-level=DEBUG$'\''\n'\''\ \ \ \ \ \ fi$'\''\n'\''\ \ \ \ \ \ echo\ -nE\ \$\'\''bye\\x1f0\\x1e\'\'' &!'
+gitstatus_start_impl:74> sysopen -w -o cloexec,sync -u req_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.pipe.req.yw8f0wTrco
+gitstatus_start_impl:75> sysopen -r -o cloexec -u resp_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.pipe.resp.Ru1c5TCA1w
+gitstatus_start_impl:72> zsh -dfmc 'cd /; /usr/local/opt/util-linux/bin/setsid zsh -dfxc $'\''\n'\''\ \ \ \ \ \ exec\ \</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.pipe.req.yw8f0wTrco\ \>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.pipe.resp.Ru1c5TCA1w\ 2\>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.daemon-log.32lDA6J8hc\ 3\</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.lock.HayprjlMUU$'\''\n'\''\ \ \ \ \ \ echo\ \$\$$'\''\n'\''\ \ \ \ \ \ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.BKOunPRJJy/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64\ --lock-fd=3\ --parent-pid=54740\ --num-threads=8\ --max-num-staged=1\ --max-num-unstaged=1\ --max-num-conflicted=1\ --max-num-untracked=1\ --dirty-max-index-size=-1\ --log-level=DEBUG$'\''\n'\''\ \ \ \ \ \ if\ \[\[\ \$\?\ \!=\ \(0\|10\)\ \&\&\ \$\?\ -le\ 128\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -z\ \'\''\'\''\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -f\ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.BKOunPRJJy/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ \]\]\;\ then$'\''\n'\''\ \ \ \ \ \ \ \ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.BKOunPRJJy/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ --lock-fd=3\ --parent-pid=54740\ --num-threads=8\ --max-num-staged=1\ --max-num-unstaged=1\ --max-num-conflicted=1\ --max-num-untracked=1\ --dirty-max-index-size=-1\ --log-level=DEBUG$'\''\n'\''\ \ \ \ \ \ fi$'\''\n'\''\ \ \ \ \ \ echo\ -nE\ \$\'\''bye\\x1f0\\x1e\'\'' &!'
+gitstatus_start_impl:77> read -u 15 daemon_pid
+gitstatus_start_impl:79> rm -f /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.pipe.req.yw8f0wTrco /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.pipe.resp.Ru1c5TCA1w /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.lock.HayprjlMUU
+gitstatus_start_impl:90> zle -F 15 _gitstatus_process_response_POWERLEVEL9K
+gitstatus_start_impl:92> local reply IFS=''
+gitstatus_start_impl:93> echo -nE $'hello\C-_\C-^'
+gitstatus_start_impl:94> read -r -d $'\C-^' -u 15 -t 5.0000000000 reply
                           ^ this command failed

The content of /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.54740.daemon-log.32lDA6J8hc (gitstatus daemon log):

+zsh:3> echo 54784
+zsh:4> /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.BKOunPRJJy/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 '--lock-fd=3' '--parent-pid=54740' '--num-threads=8' '--max-num-staged=1' '--max-num-unstaged=1' '--max-num-conflicted=1' '--max-num-untracked=1' '--dirty-max-index-size=-1' '--log-level=DEBUG'
[2019-08-10 02:35:45 00000001094235c0 INFO src/gitstatus.cc:157] argv[0]: "/private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.BKOunPRJJy/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64"
[2019-08-10 02:35:45 00000001094235c0 INFO src/gitstatus.cc:157] argv[1]: "--lock-fd=3"
[2019-08-10 02:35:45 00000001094235c0 INFO src/gitstatus.cc:157] argv[2]: "--parent-pid=54740"
[2019-08-10 02:35:45 00000001094235c0 INFO src/gitstatus.cc:157] argv[3]: "--num-threads=8"
[2019-08-10 02:35:45 00000001094235c0 INFO src/gitstatus.cc:157] argv[4]: "--max-num-staged=1"
[2019-08-10 02:35:45 00000001094235c0 INFO src/gitstatus.cc:157] argv[5]: "--max-num-unstaged=1"
[2019-08-10 02:35:45 00000001094235c0 INFO src/gitstatus.cc:157] argv[6]: "--max-num-conflicted=1"
[2019-08-10 02:35:45 00000001094235c0 INFO src/gitstatus.cc:157] argv[7]: "--max-num-untracked=1"
[2019-08-10 02:35:45 00000001094235c0 INFO src/gitstatus.cc:157] argv[8]: "--dirty-max-index-size=-1"
[2019-08-10 02:35:45 00000001094235c0 INFO src/gitstatus.cc:157] argv[9]: "--log-level=DEBUG"
[2019-08-10 02:35:45 00000001094235c0 INFO src/thread_pool.cc:81] Spawning 8 thread(s)
[2019-08-10 02:35:50 00000001094235c0 INFO src/request.cc:110] EOF. Exiting.

Your system information:

zsh:      5.7.1
uname -a: Darwin c4b301d3c8fd.ant.amazon.com 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64

If you need help, open an issue and attach this whole error message to it:

omarbaza@c4b301d3c8fd  /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.BKOunPRJJy 

romkatv commented 5 years ago

Another one:

(
  emulate -L zsh
  setopt err_return no_unset
  local tmp && tmp=$(mktemp -d "${TMPDIR:-/tmp}"/p10k.XXXXXXXXXX)
  {
    cd $tmp
    git clone -b dev --depth 1 https://github.com/romkatv/powerlevel10k.git
    echo "source ${(q)tmp}/powerlevel10k/powerlevel10k.zsh-theme" >>$tmp/.zshrc
    ZDOTDIR=$tmp GITSTATUS_LOG_LEVEL=DEBUG POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true zsh -d
  } always {
    cd || true
    rm -rf $tmp
  }
)
omarbaza commented 5 years ago

Last login: Sat Aug 10 02:41:27 on ttys000    ~  (  ✔ emulate -L zsh setopt err_return no_unset local tmp && tmp=$(mktemp -d "${TMPDIR:-/tmp}"/p10k.XXXXXXXXXX) { cd $tmp git clone -b dev --depth 1 https://github.com/romkatv/powerlevel10k.git echo "source ${(q)tmp}/powerlevel10k/powerlevel10k.zsh-theme" >>$tmp/.zshrc ZDOTDIR=$tmp GITSTATUS_LOG_LEVEL=DEBUG POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true zsh -d } always { cd || true rm -rf $tmp } ) Cloning into 'powerlevel10k'... remote: Enumerating objects: 39, done. remote: Counting objects: 100% (39/39), done. remote: Compressing objects: 100% (34/34), done. remote: Total 39 (delta 1), reused 15 (delta 0), pack-reused 0 Unpacking objects: 100% (39/39), done. [ERROR]: gitstatus failed to initialize.

Your git prompt may disappear or become slow.

The content of /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.xtrace.5CSqLrMS5A (gitstatus_start_impl xtrace):

+gitstatus_start_impl:11> local os
+gitstatus_start_impl:11> os=+gitstatus_start_impl:11> uname -s
+gitstatus_start_impl:11> os=Darwin
+gitstatus_start_impl:11> [[ -n Darwin ]]
+gitstatus_start_impl:12> [[ Darwin != Linux ]]
+gitstatus_start_impl:13> local arch
+gitstatus_start_impl:13> arch=+gitstatus_start_impl:13> uname -m
+gitstatus_start_impl:13> arch=x86_64
+gitstatus_start_impl:13> [[ -n x86_64 ]]
+gitstatus_start_impl:15> local daemon=/private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.hefANxqOH7/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64
+gitstatus_start_impl:16> [[ -f /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.hefANxqOH7/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 ]]
+gitstatus_start_impl:18> lock_file=+gitstatus_start_impl:18> mktemp /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.lock.XXXXXXXXXX
+gitstatus_start_impl:18> lock_file=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.lock.MNp40971EZ
+gitstatus_start_impl:19> zsystem flock -f lock_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.lock.MNp40971EZ
+gitstatus_start_impl:21> req_fifo=+gitstatus_start_impl:21> mktemp -u /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.pipe.req.XXXXXXXXXX
+gitstatus_start_impl:21> req_fifo=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.pipe.req.wPsiAwti4v
+gitstatus_start_impl:22> mkfifo /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.pipe.req.wPsiAwti4v
+gitstatus_start_impl:24> resp_fifo=+gitstatus_start_impl:24> mktemp -u /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.pipe.resp.XXXXXXXXXX
+gitstatus_start_impl:24> resp_fifo=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.pipe.resp.IERsh5NAaH
+gitstatus_start_impl:25> mkfifo /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.pipe.resp.IERsh5NAaH
+gitstatus_start_impl:27> [[ -n DEBUG ]]
+gitstatus_start_impl:28> log_file=+gitstatus_start_impl:28> mktemp /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.daemon-log.XXXXXXXXXX
+gitstatus_start_impl:28> log_file=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.daemon-log.CMaD8tIorV
+gitstatus_start_impl:30> typeset -g 'GITSTATUS_DAEMON_LOG_POWERLEVEL9K=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.daemon-log.CMaD8tIorV'
+gitstatus_start_impl:32> local -i threads=0
+gitstatus_start_impl:33> ((  threads > 0 ))
+gitstatus_start_impl:34> threads=8
+gitstatus_start_impl:35> case Darwin (FreeBSD)
+gitstatus_start_impl:35> case Darwin (*)
+gitstatus_start_impl:37> ((  ! 1  ))
+gitstatus_start_impl:37> threads=+gitstatus_start_impl:37> getconf _NPROCESSORS_ONLN
+gitstatus_start_impl:37> threads=8
+gitstatus_start_impl:39> ((  threads <= 32  ))
+gitstatus_start_impl:42> local -a daemon_args=( '--lock-fd=3' '--parent-pid=55348' '--num-threads=8' '--max-num-staged=1' '--max-num-unstaged=1' '--max-num-conflicted=1' '--max-num-untracked=1' '--dirty-max-index-size=-1' '--log-level=DEBUG' )
+gitstatus_start_impl:53> local cmd=$'\n      exec </var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.pipe.req.wPsiAwti4v >/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.pipe.resp.IERsh5NAaH 2>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.daemon-log.CMaD8tIorV 3</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.lock.MNp40971EZ\n      echo $$\n      /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.hefANxqOH7/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 --lock-fd=3 --parent-pid=55348 --num-threads=8 --max-num-staged=1 --max-num-unstaged=1 --max-num-conflicted=1 --max-num-untracked=1 --dirty-max-index-size=-1 --log-level=DEBUG\n      if [[ $? != (0|10) && $? -le 128 &&\n            -z \'\' &&\n            -f /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.hefANxqOH7/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static ]]; then\n        /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.hefANxqOH7/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static --lock-fd=3 --parent-pid=55348 --num-threads=8 --max-num-staged=1 --max-num-unstaged=1 --max-num-conflicted=1 --max-num-untracked=1 --dirty-max-index-size=-1 --log-level=DEBUG\n      fi\n      echo -nE $\'bye\\x1f0\\x1e\''
+gitstatus_start_impl:63> local setsid=/usr/local/opt/util-linux/bin/setsid
+gitstatus_start_impl:64> [[ -f /usr/local/opt/util-linux/bin/setsid ]]
+gitstatus_start_impl:64> setsid=/usr/local/opt/util-linux/bin/setsid
+gitstatus_start_impl:65> cmd='cd /; /usr/local/opt/util-linux/bin/setsid zsh -dfxc $'\''\n'\''\ \ \ \ \ \ exec\ \</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.pipe.req.wPsiAwti4v\ \>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.pipe.resp.IERsh5NAaH\ 2\>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.daemon-log.CMaD8tIorV\ 3\</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.lock.MNp40971EZ$'\''\n'\''\ \ \ \ \ \ echo\ \$\$$'\''\n'\''\ \ \ \ \ \ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.hefANxqOH7/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64\ --lock-fd=3\ --parent-pid=55348\ --num-threads=8\ --max-num-staged=1\ --max-num-unstaged=1\ --max-num-conflicted=1\ --max-num-untracked=1\ --dirty-max-index-size=-1\ --log-level=DEBUG$'\''\n'\''\ \ \ \ \ \ if\ \[\[\ \$\?\ !=\ \(0\|10\)\ \&\&\ \$\?\ -le\ 128\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -z\ \'\''\'\''\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -f\ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.hefANxqOH7/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ \]\]\;\ then$'\''\n'\''\ \ \ \ \ \ \ \ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.hefANxqOH7/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ --lock-fd=3\ --parent-pid=55348\ --num-threads=8\ --max-num-staged=1\ --max-num-unstaged=1\ --max-num-conflicted=1\ --max-num-untracked=1\ --dirty-max-index-size=-1\ --log-level=DEBUG$'\''\n'\''\ \ \ \ \ \ fi$'\''\n'\''\ \ \ \ \ \ echo\ -nE\ \$\'\''bye\\x1f0\\x1e\'\'' &!'
+gitstatus_start_impl:74> sysopen -w -o cloexec,sync -u req_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.pipe.req.wPsiAwti4v
+gitstatus_start_impl:75> sysopen -r -o cloexec -u resp_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.pipe.resp.IERsh5NAaH
+gitstatus_start_impl:72> zsh -dfmc 'cd /; /usr/local/opt/util-linux/bin/setsid zsh -dfxc $'\''\n'\''\ \ \ \ \ \ exec\ \</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.pipe.req.wPsiAwti4v\ \>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.pipe.resp.IERsh5NAaH\ 2\>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.daemon-log.CMaD8tIorV\ 3\</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.lock.MNp40971EZ$'\''\n'\''\ \ \ \ \ \ echo\ \$\$$'\''\n'\''\ \ \ \ \ \ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.hefANxqOH7/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64\ --lock-fd=3\ --parent-pid=55348\ --num-threads=8\ --max-num-staged=1\ --max-num-unstaged=1\ --max-num-conflicted=1\ --max-num-untracked=1\ --dirty-max-index-size=-1\ --log-level=DEBUG$'\''\n'\''\ \ \ \ \ \ if\ \[\[\ \$\?\ !=\ \(0\|10\)\ \&\&\ \$\?\ -le\ 128\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -z\ \'\''\'\''\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -f\ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.hefANxqOH7/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ \]\]\;\ then$'\''\n'\''\ \ \ \ \ \ \ \ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.hefANxqOH7/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ --lock-fd=3\ --parent-pid=55348\ --num-threads=8\ --max-num-staged=1\ --max-num-unstaged=1\ --max-num-conflicted=1\ --max-num-untracked=1\ --dirty-max-index-size=-1\ --log-level=DEBUG$'\''\n'\''\ \ \ \ \ \ fi$'\''\n'\''\ \ \ \ \ \ echo\ -nE\ \$\'\''bye\\x1f0\\x1e\'\'' &!'
+gitstatus_start_impl:77> read -u 15 daemon_pid
+gitstatus_start_impl:88> zle -F 15 _gitstatus_process_response_POWERLEVEL9K
+gitstatus_start_impl:90> local reply IFS=''
+gitstatus_start_impl:91> echo -nE $'hello\C-_\C-^'
+gitstatus_start_impl:92> read -r -d $'\C-^' -u 15 -t 5.0000000000 reply
                           ^ this command failed

The content of /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.55348.daemon-log.CMaD8tIorV (gitstatus daemon log):

+zsh:3> echo 55368
+zsh:4> /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.hefANxqOH7/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 '--lock-fd=3' '--parent-pid=55348' '--num-threads=8' '--max-num-staged=1' '--max-num-unstaged=1' '--max-num-conflicted=1' '--max-num-untracked=1' '--dirty-max-index-size=-1' '--log-level=DEBUG'
[2019-08-10 02:41:38 00000001198925c0 INFO src/gitstatus.cc:157] argv[0]: "/private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.hefANxqOH7/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64"
[2019-08-10 02:41:38 00000001198925c0 INFO src/gitstatus.cc:157] argv[1]: "--lock-fd=3"
[2019-08-10 02:41:38 00000001198925c0 INFO src/gitstatus.cc:157] argv[2]: "--parent-pid=55348"
[2019-08-10 02:41:38 00000001198925c0 INFO src/gitstatus.cc:157] argv[3]: "--num-threads=8"
[2019-08-10 02:41:38 00000001198925c0 INFO src/gitstatus.cc:157] argv[4]: "--max-num-staged=1"
[2019-08-10 02:41:38 00000001198925c0 INFO src/gitstatus.cc:157] argv[5]: "--max-num-unstaged=1"
[2019-08-10 02:41:38 00000001198925c0 INFO src/gitstatus.cc:157] argv[6]: "--max-num-conflicted=1"
[2019-08-10 02:41:38 00000001198925c0 INFO src/gitstatus.cc:157] argv[7]: "--max-num-untracked=1"
[2019-08-10 02:41:38 00000001198925c0 INFO src/gitstatus.cc:157] argv[8]: "--dirty-max-index-size=-1"
[2019-08-10 02:41:38 00000001198925c0 INFO src/gitstatus.cc:157] argv[9]: "--log-level=DEBUG"
[2019-08-10 02:41:38 00000001198925c0 INFO src/thread_pool.cc:81] Spawning 8 thread(s)
[2019-08-10 02:41:43 00000001198925c0 INFO src/request.cc:110] EOF. Exiting.

Your system information:

zsh:      5.7.1
uname -a: Darwin c4b301d3c8fd.ant.amazon.com 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64

If you need help, open an issue and attach this whole error message to it:

omarbaza@c4b301d3c8fd  /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.hefANxqOH7   ✔  1  02:41:43

omarbaza commented 5 years ago

I made an experiment...

Previously I updated the zsh version of shell using brew and this instructions: https://rick.cogley.info/post/use-homebrew-zsh-instead-of-the-osx-default/

I rolled back those changes (using default zsh 5.3) uninstalling (brew uninstall zsh) and running "sudo dscl . -create /Users/$USER UserShell /bin/zsh"

I noticed that I'm not getting that error anymore... HOWEVER, it takes from 3-10 seconds to give me a prompt... that is pretty long isn't it?

romkatv commented 5 years ago

Let's deal with one problem at a time. Please revert back to the state where you were getting errors. Then run the same command as last time.

omarbaza commented 5 years ago

Ok, back to 5.7.1

Last login: Sat Aug 10 03:01:46 on ttys000 [ERROR]: gitstatus failed to initialize.

Your git prompt may disappear or become slow.

Run the following command to retry with extra diagnostics:

GITSTATUS_LOG_LEVEL=DEBUG gitstatus_start -s -1 -u -1 -d -1 -c -1 -m -1 POWERLEVEL9K

   ~  (  ✔ emulate -L zsh setopt err_return no_unset local tmp && tmp=$(mktemp -d "${TMPDIR:-/tmp}"/p10k.XXXXXXXXXX) { cd $tmp git clone -b dev --depth 1 https://github.com/romkatv/powerlevel10k.git echo "source ${(q)tmp}/powerlevel10k/powerlevel10k.zsh-theme" >>$tmp/.zshrc ZDOTDIR=$tmp GITSTATUS_LOG_LEVEL=DEBUG POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true zsh -d } always { cd || true rm -rf $tmp } ) Cloning into 'powerlevel10k'... remote: Enumerating objects: 39, done. remote: Counting objects: 100% (39/39), done. remote: Compressing objects: 100% (34/34), done. remote: Total 39 (delta 1), reused 15 (delta 0), pack-reused 0 Unpacking objects: 100% (39/39), done. [ERROR]: gitstatus failed to initialize.

Your git prompt may disappear or become slow.

The content of /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.xtrace.XA6hJUSXp2 (gitstatus_start_impl xtrace):

+gitstatus_start_impl:11> local os
+gitstatus_start_impl:11> os=+gitstatus_start_impl:11> uname -s
+gitstatus_start_impl:11> os=Darwin
+gitstatus_start_impl:11> [[ -n Darwin ]]
+gitstatus_start_impl:12> [[ Darwin != Linux ]]
+gitstatus_start_impl:13> local arch
+gitstatus_start_impl:13> arch=+gitstatus_start_impl:13> uname -m
+gitstatus_start_impl:13> arch=x86_64
+gitstatus_start_impl:13> [[ -n x86_64 ]]
+gitstatus_start_impl:15> local daemon=/private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.FCifKlIWfd/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64
+gitstatus_start_impl:16> [[ -f /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.FCifKlIWfd/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 ]]
+gitstatus_start_impl:18> lock_file=+gitstatus_start_impl:18> mktemp /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.lock.XXXXXXXXXX
+gitstatus_start_impl:18> lock_file=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.lock.9VlzNgUxDZ
+gitstatus_start_impl:19> zsystem flock -f lock_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.lock.9VlzNgUxDZ
+gitstatus_start_impl:21> req_fifo=+gitstatus_start_impl:21> mktemp -u /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.pipe.req.XXXXXXXXXX
+gitstatus_start_impl:21> req_fifo=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.pipe.req.0Ouoxd7iPu
+gitstatus_start_impl:22> mkfifo /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.pipe.req.0Ouoxd7iPu
+gitstatus_start_impl:24> resp_fifo=+gitstatus_start_impl:24> mktemp -u /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.pipe.resp.XXXXXXXXXX
+gitstatus_start_impl:24> resp_fifo=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.pipe.resp.0N1L1vK9F3
+gitstatus_start_impl:25> mkfifo /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.pipe.resp.0N1L1vK9F3
+gitstatus_start_impl:27> [[ -n DEBUG ]]
+gitstatus_start_impl:28> log_file=+gitstatus_start_impl:28> mktemp /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.daemon-log.XXXXXXXXXX
+gitstatus_start_impl:28> log_file=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.daemon-log.23LEHaQWW2
+gitstatus_start_impl:30> typeset -g 'GITSTATUS_DAEMON_LOG_POWERLEVEL9K=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.daemon-log.23LEHaQWW2'
+gitstatus_start_impl:32> local -i threads=0
+gitstatus_start_impl:33> ((  threads > 0 ))
+gitstatus_start_impl:34> threads=8
+gitstatus_start_impl:35> case Darwin (FreeBSD)
+gitstatus_start_impl:35> case Darwin (*)
+gitstatus_start_impl:37> ((  ! 1  ))
+gitstatus_start_impl:37> threads=+gitstatus_start_impl:37> getconf _NPROCESSORS_ONLN
+gitstatus_start_impl:37> threads=8
+gitstatus_start_impl:39> ((  threads <= 32  ))
+gitstatus_start_impl:42> local -a daemon_args=( '--lock-fd=3' '--parent-pid=58461' '--num-threads=8' '--max-num-staged=1' '--max-num-unstaged=1' '--max-num-conflicted=1' '--max-num-untracked=1' '--dirty-max-index-size=-1' '--log-level=DEBUG' )
+gitstatus_start_impl:53> local cmd=$'\n      exec >/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.pipe.resp.0N1L1vK9F3 2>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.daemon-log.23LEHaQWW2\n      echo $$\n      /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.FCifKlIWfd/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 --lock-fd=3 --parent-pid=58461 --num-threads=8 --max-num-staged=1 --max-num-unstaged=1 --max-num-conflicted=1 --max-num-untracked=1 --dirty-max-index-size=-1 --log-level=DEBUG </var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.pipe.req.0Ouoxd7iPu 3</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.lock.9VlzNgUxDZ\n      if [[ $? != (0|10) && $? -le 128 &&\n            -z \'\' &&\n            -f /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.FCifKlIWfd/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static ]]; then\n        /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.FCifKlIWfd/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static --lock-fd=3 --parent-pid=58461 --num-threads=8 --max-num-staged=1 --max-num-unstaged=1 --max-num-conflicted=1 --max-num-untracked=1 --dirty-max-index-size=-1 --log-level=DEBUG </var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.pipe.req.0Ouoxd7iPu 3</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.lock.9VlzNgUxDZ\n      fi\n      echo -nE $\'bye\\x1f0\\x1e\''
+gitstatus_start_impl:63> local setsid=/usr/local/opt/util-linux/bin/setsid
+gitstatus_start_impl:64> [[ -f /usr/local/opt/util-linux/bin/setsid ]]
+gitstatus_start_impl:64> setsid=/usr/local/opt/util-linux/bin/setsid
+gitstatus_start_impl:65> cmd='cd /; /usr/local/opt/util-linux/bin/setsid zsh -dfxc $'\''\n'\''\ \ \ \ \ \ exec\ \>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.pipe.resp.0N1L1vK9F3\ 2\>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.daemon-log.23LEHaQWW2$'\''\n'\''\ \ \ \ \ \ echo\ \$\$$'\''\n'\''\ \ \ \ \ \ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.FCifKlIWfd/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64\ --lock-fd=3\ --parent-pid=58461\ --num-threads=8\ --max-num-staged=1\ --max-num-unstaged=1\ --max-num-conflicted=1\ --max-num-untracked=1\ --dirty-max-index-size=-1\ --log-level=DEBUG\ \</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.pipe.req.0Ouoxd7iPu\ 3\</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.lock.9VlzNgUxDZ$'\''\n'\''\ \ \ \ \ \ if\ \[\[\ \$\?\ !=\ \(0\|10\)\ \&\&\ \$\?\ -le\ 128\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -z\ \'\''\'\''\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -f\ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.FCifKlIWfd/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ \]\]\;\ then$'\''\n'\''\ \ \ \ \ \ \ \ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.FCifKlIWfd/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ --lock-fd=3\ --parent-pid=58461\ --num-threads=8\ --max-num-staged=1\ --max-num-unstaged=1\ --max-num-conflicted=1\ --max-num-untracked=1\ --dirty-max-index-size=-1\ --log-level=DEBUG\ \</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.pipe.req.0Ouoxd7iPu\ 3\</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.lock.9VlzNgUxDZ$'\''\n'\''\ \ \ \ \ \ fi$'\''\n'\''\ \ \ \ \ \ echo\ -nE\ \$\'\''bye\\x1f0\\x1e\'\'' &!'
+gitstatus_start_impl:74> sysopen -r -o cloexec -u resp_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.pipe.resp.0N1L1vK9F3
+gitstatus_start_impl:72> zsh -dfmc 'cd /; /usr/local/opt/util-linux/bin/setsid zsh -dfxc $'\''\n'\''\ \ \ \ \ \ exec\ \>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.pipe.resp.0N1L1vK9F3\ 2\>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.daemon-log.23LEHaQWW2$'\''\n'\''\ \ \ \ \ \ echo\ \$\$$'\''\n'\''\ \ \ \ \ \ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.FCifKlIWfd/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64\ --lock-fd=3\ --parent-pid=58461\ --num-threads=8\ --max-num-staged=1\ --max-num-unstaged=1\ --max-num-conflicted=1\ --max-num-untracked=1\ --dirty-max-index-size=-1\ --log-level=DEBUG\ \</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.pipe.req.0Ouoxd7iPu\ 3\</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.lock.9VlzNgUxDZ$'\''\n'\''\ \ \ \ \ \ if\ \[\[\ \$\?\ !=\ \(0\|10\)\ \&\&\ \$\?\ -le\ 128\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -z\ \'\''\'\''\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -f\ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.FCifKlIWfd/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ \]\]\;\ then$'\''\n'\''\ \ \ \ \ \ \ \ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.FCifKlIWfd/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ --lock-fd=3\ --parent-pid=58461\ --num-threads=8\ --max-num-staged=1\ --max-num-unstaged=1\ --max-num-conflicted=1\ --max-num-untracked=1\ --dirty-max-index-size=-1\ --log-level=DEBUG\ \</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.pipe.req.0Ouoxd7iPu\ 3\</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.lock.9VlzNgUxDZ$'\''\n'\''\ \ \ \ \ \ fi$'\''\n'\''\ \ \ \ \ \ echo\ -nE\ \$\'\''bye\\x1f0\\x1e\'\'' &!'
+gitstatus_start_impl:75> read -u 14 daemon_pid
+gitstatus_start_impl:76> sysopen -w -o cloexec,sync -u req_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.pipe.req.0Ouoxd7iPu
+gitstatus_start_impl:87> zle -F 14 _gitstatus_process_response_POWERLEVEL9K
+gitstatus_start_impl:89> local reply IFS=''
+gitstatus_start_impl:90> echo -nE $'hello\C-_\C-^'
+gitstatus_start_impl:91> read -r -d $'\C-^' -u 14 -t 5.0000000000 reply
                           ^ this command failed

The content of /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.58461.daemon-log.23LEHaQWW2 (gitstatus daemon log):

+zsh:3> echo 58487
+zsh:4> /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.FCifKlIWfd/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 '--lock-fd=3' '--parent-pid=58461' '--num-threads=8' '--max-num-staged=1' '--max-num-unstaged=1' '--max-num-conflicted=1' '--max-num-untracked=1' '--dirty-max-index-size=-1' '--log-level=DEBUG'
[2019-08-10 03:02:03 00000001170a75c0 INFO src/gitstatus.cc:157] argv[0]: "/private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.FCifKlIWfd/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64"
[2019-08-10 03:02:03 00000001170a75c0 INFO src/gitstatus.cc:157] argv[1]: "--lock-fd=3"
[2019-08-10 03:02:03 00000001170a75c0 INFO src/gitstatus.cc:157] argv[2]: "--parent-pid=58461"
[2019-08-10 03:02:03 00000001170a75c0 INFO src/gitstatus.cc:157] argv[3]: "--num-threads=8"
[2019-08-10 03:02:03 00000001170a75c0 INFO src/gitstatus.cc:157] argv[4]: "--max-num-staged=1"
[2019-08-10 03:02:03 00000001170a75c0 INFO src/gitstatus.cc:157] argv[5]: "--max-num-unstaged=1"
[2019-08-10 03:02:03 00000001170a75c0 INFO src/gitstatus.cc:157] argv[6]: "--max-num-conflicted=1"
[2019-08-10 03:02:03 00000001170a75c0 INFO src/gitstatus.cc:157] argv[7]: "--max-num-untracked=1"
[2019-08-10 03:02:03 00000001170a75c0 INFO src/gitstatus.cc:157] argv[8]: "--dirty-max-index-size=-1"
[2019-08-10 03:02:03 00000001170a75c0 INFO src/gitstatus.cc:157] argv[9]: "--log-level=DEBUG"
[2019-08-10 03:02:03 00000001170a75c0 INFO src/thread_pool.cc:81] Spawning 8 thread(s)
[2019-08-10 03:02:08 00000001170a75c0 INFO src/request.cc:110] EOF. Exiting.

Your system information:

zsh:      5.7.1
uname -a: Darwin c4b301d3c8fd.ant.amazon.com 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64

If you need help, open an issue and attach this whole error message to it:

omarbaza@c4b301d3c8fd  /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.FCifKlIWfd   ✔  1  03:02:08

romkatv commented 5 years ago

Thanks.

Still would like to know the answer to https://github.com/romkatv/gitstatus/issues/54#issuecomment-520131948.

omarbaza commented 5 years ago

By the way, does it fail instantly or does it hang for 5 seconds before failing?

hangs for 5 seconds before failing.

If I open terminal/iTerm and it takes 5-10 seconds to give me prompt, I know for sure it will fail. Usually If I run those commands they will fail as well.

If I open terminal and gives me prompt within 1-2 seconds, then the commands won't fail

romkatv commented 5 years ago

Please run the same command again.

Also this:

launchctl limit maxfiles
lsof -p $$ | wc -l
lsof | wc -l
omarbaza commented 5 years ago

Last login: Sat Aug 10 08:33:42 on ttys000 [ERROR]: gitstatus failed to initialize.

Your git prompt may disappear or become slow.

Run the following command to retry with extra diagnostics:

GITSTATUS_LOG_LEVEL=DEBUG gitstatus_start -s -1 -u -1 -d -1 -c -1 -m -1 POWERLEVEL9K

   ~  (  ✔ emulate -L zsh setopt err_return no_unset local tmp && tmp=$(mktemp -d "${TMPDIR:-/tmp}"/p10k.XXXXXXXXXX) { cd $tmp git clone -b dev --depth 1 https://github.com/romkatv/powerlevel10k.git echo "source ${(q)tmp}/powerlevel10k/powerlevel10k.zsh-theme" >>$tmp/.zshrc ZDOTDIR=$tmp GITSTATUS_LOG_LEVEL=DEBUG POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true zsh -d } always { cd || true rm -rf $tmp } ) Cloning into 'powerlevel10k'... remote: Enumerating objects: 39, done. remote: Counting objects: 100% (39/39), done. remote: Compressing objects: 100% (34/34), done. remote: Total 39 (delta 1), reused 15 (delta 0), pack-reused 0 Unpacking objects: 100% (39/39), done. [ERROR]: gitstatus failed to initialize.

Your git prompt may disappear or become slow.

The content of /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.xtrace.yL8sCAGwtd (gitstatus_start_impl xtrace):

+gitstatus_start_impl:11> local os
+gitstatus_start_impl:11> os=+gitstatus_start_impl:11> uname -s
+gitstatus_start_impl:11> os=Darwin
+gitstatus_start_impl:11> [[ -n Darwin ]]
+gitstatus_start_impl:12> [[ Darwin != Linux ]]
+gitstatus_start_impl:13> local arch
+gitstatus_start_impl:13> arch=+gitstatus_start_impl:13> uname -m
+gitstatus_start_impl:13> arch=x86_64
+gitstatus_start_impl:13> [[ -n x86_64 ]]
+gitstatus_start_impl:15> local daemon=/private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.smeWizUq43/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64
+gitstatus_start_impl:16> [[ -f /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.smeWizUq43/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 ]]
+gitstatus_start_impl:18> lock_file=+gitstatus_start_impl:18> mktemp /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.lock.XXXXXXXXXX
+gitstatus_start_impl:18> lock_file=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.lock.5ACVrfveyc
+gitstatus_start_impl:19> zsystem flock -f lock_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.lock.5ACVrfveyc
+gitstatus_start_impl:21> req_fifo=+gitstatus_start_impl:21> mktemp -u /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.pipe.req.XXXXXXXXXX
+gitstatus_start_impl:21> req_fifo=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.pipe.req.Pic8b5oTfI
+gitstatus_start_impl:22> mkfifo /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.pipe.req.Pic8b5oTfI
+gitstatus_start_impl:24> resp_fifo=+gitstatus_start_impl:24> mktemp -u /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.pipe.resp.XXXXXXXXXX
+gitstatus_start_impl:24> resp_fifo=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.pipe.resp.G9jJgdslMX
+gitstatus_start_impl:25> mkfifo /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.pipe.resp.G9jJgdslMX
+gitstatus_start_impl:27> [[ -n DEBUG ]]
+gitstatus_start_impl:28> log_file=+gitstatus_start_impl:28> mktemp /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.daemon-log.XXXXXXXXXX
+gitstatus_start_impl:28> log_file=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.daemon-log.ofgVZZC3YF
+gitstatus_start_impl:30> typeset -g 'GITSTATUS_DAEMON_LOG_POWERLEVEL9K=/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.daemon-log.ofgVZZC3YF'
+gitstatus_start_impl:32> local -i threads=0
+gitstatus_start_impl:33> ((  threads > 0 ))
+gitstatus_start_impl:34> threads=8
+gitstatus_start_impl:35> case Darwin (FreeBSD)
+gitstatus_start_impl:35> case Darwin (*)
+gitstatus_start_impl:37> ((  ! 1  ))
+gitstatus_start_impl:37> threads=+gitstatus_start_impl:37> getconf _NPROCESSORS_ONLN
+gitstatus_start_impl:37> threads=8
+gitstatus_start_impl:39> ((  threads <= 32  ))
+gitstatus_start_impl:42> local -a daemon_args=( '--lock-fd=3' '--parent-pid=59757' '--num-threads=8' '--max-num-staged=1' '--max-num-unstaged=1' '--max-num-conflicted=1' '--max-num-untracked=1' '--dirty-max-index-size=-1' '--log-level=DEBUG' )
+gitstatus_start_impl:53> local cmd=$'\n      exec >/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.pipe.resp.G9jJgdslMX 2>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.daemon-log.ofgVZZC3YF\n      echo $$\n      zmodload zsh/system\n      sysopen -r -u req_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.pipe.req.Pic8b5oTfI\n      /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.smeWizUq43/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 --lock-fd=3 --parent-pid=59757 --num-threads=8 --max-num-staged=1 --max-num-unstaged=1 --max-num-conflicted=1 --max-num-untracked=1 --dirty-max-index-size=-1 --log-level=DEBUG <&$req_fd 3</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.lock.5ACVrfveyc\n      if [[ $? != (0|10) && $? -le 128 &&\n            -z \'\' &&\n            -f /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.smeWizUq43/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static ]]; then\n        /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.smeWizUq43/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static --lock-fd=3 --parent-pid=59757 --num-threads=8 --max-num-staged=1 --max-num-unstaged=1 --max-num-conflicted=1 --max-num-untracked=1 --dirty-max-index-size=-1 --log-level=DEBUG <&$req_fd 3</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.lock.5ACVrfveyc\n      fi\n      echo -nE $\'bye\\x1f0\\x1e\''
+gitstatus_start_impl:65> local setsid=/usr/local/opt/util-linux/bin/setsid
+gitstatus_start_impl:66> [[ -f /usr/local/opt/util-linux/bin/setsid ]]
+gitstatus_start_impl:66> setsid=/usr/local/opt/util-linux/bin/setsid
+gitstatus_start_impl:67> cmd='cd /; /usr/local/opt/util-linux/bin/setsid zsh -dfxc $'\''\n'\''\ \ \ \ \ \ exec\ \>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.pipe.resp.G9jJgdslMX\ 2\>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.daemon-log.ofgVZZC3YF$'\''\n'\''\ \ \ \ \ \ echo\ \$\$$'\''\n'\''\ \ \ \ \ \ zmodload\ zsh/system$'\''\n'\''\ \ \ \ \ \ sysopen\ -r\ -u\ req_fd\ /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.pipe.req.Pic8b5oTfI$'\''\n'\''\ \ \ \ \ \ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.smeWizUq43/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64\ --lock-fd=3\ --parent-pid=59757\ --num-threads=8\ --max-num-staged=1\ --max-num-unstaged=1\ --max-num-conflicted=1\ --max-num-untracked=1\ --dirty-max-index-size=-1\ --log-level=DEBUG\ \<\&\$req_fd\ 3\</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.lock.5ACVrfveyc$'\''\n'\''\ \ \ \ \ \ if\ \[\[\ \$\?\ !=\ \(0\|10\)\ \&\&\ \$\?\ -le\ 128\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -z\ \'\''\'\''\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -f\ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.smeWizUq43/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ \]\]\;\ then$'\''\n'\''\ \ \ \ \ \ \ \ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.smeWizUq43/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ --lock-fd=3\ --parent-pid=59757\ --num-threads=8\ --max-num-staged=1\ --max-num-unstaged=1\ --max-num-conflicted=1\ --max-num-untracked=1\ --dirty-max-index-size=-1\ --log-level=DEBUG\ \<\&\$req_fd\ 3\</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.lock.5ACVrfveyc$'\''\n'\''\ \ \ \ \ \ fi$'\''\n'\''\ \ \ \ \ \ echo\ -nE\ \$\'\''bye\\x1f0\\x1e\'\'' &!'
+gitstatus_start_impl:76> sysopen -r -o cloexec -u resp_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.pipe.resp.G9jJgdslMX
+gitstatus_start_impl:74> zsh -dfmc 'cd /; /usr/local/opt/util-linux/bin/setsid zsh -dfxc $'\''\n'\''\ \ \ \ \ \ exec\ \>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.pipe.resp.G9jJgdslMX\ 2\>/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.daemon-log.ofgVZZC3YF$'\''\n'\''\ \ \ \ \ \ echo\ \$\$$'\''\n'\''\ \ \ \ \ \ zmodload\ zsh/system$'\''\n'\''\ \ \ \ \ \ sysopen\ -r\ -u\ req_fd\ /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.pipe.req.Pic8b5oTfI$'\''\n'\''\ \ \ \ \ \ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.smeWizUq43/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64\ --lock-fd=3\ --parent-pid=59757\ --num-threads=8\ --max-num-staged=1\ --max-num-unstaged=1\ --max-num-conflicted=1\ --max-num-untracked=1\ --dirty-max-index-size=-1\ --log-level=DEBUG\ \<\&\$req_fd\ 3\</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.lock.5ACVrfveyc$'\''\n'\''\ \ \ \ \ \ if\ \[\[\ \$\?\ !=\ \(0\|10\)\ \&\&\ \$\?\ -le\ 128\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -z\ \'\''\'\''\ \&\&$'\''\n'\''\ \ \ \ \ \ \ \ \ \ \ \ -f\ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.smeWizUq43/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ \]\]\;\ then$'\''\n'\''\ \ \ \ \ \ \ \ /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.smeWizUq43/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64-static\ --lock-fd=3\ --parent-pid=59757\ --num-threads=8\ --max-num-staged=1\ --max-num-unstaged=1\ --max-num-conflicted=1\ --max-num-untracked=1\ --dirty-max-index-size=-1\ --log-level=DEBUG\ \<\&\$req_fd\ 3\</var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.lock.5ACVrfveyc$'\''\n'\''\ \ \ \ \ \ fi$'\''\n'\''\ \ \ \ \ \ echo\ -nE\ \$\'\''bye\\x1f0\\x1e\'\'' &!'
+gitstatus_start_impl:77> read -u 14 daemon_pid
+gitstatus_start_impl:78> sysopen -w -o cloexec,sync -u req_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.pipe.req.Pic8b5oTfI
+gitstatus_start_impl:89> zle -F 14 _gitstatus_process_response_POWERLEVEL9K
+gitstatus_start_impl:91> local reply IFS=''
+gitstatus_start_impl:92> echo -nE $'hello\C-_\C-^'
+gitstatus_start_impl:93> read -r -d $'\C-^' -u 14 -t 5.0000000000 reply
                           ^ this command failed

The content of /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.daemon-log.ofgVZZC3YF (gitstatus daemon log):

+zsh:3> echo 59783
+zsh:4> zmodload zsh/system
+zsh:5> sysopen -r -u req_fd /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T//gitstatus.59757.pipe.req.Pic8b5oTfI
+zsh:6> /private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.smeWizUq43/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64 '--lock-fd=3' '--parent-pid=59757' '--num-threads=8' '--max-num-staged=1' '--max-num-unstaged=1' '--max-num-conflicted=1' '--max-num-untracked=1' '--dirty-max-index-size=-1' '--log-level=DEBUG'
[2019-08-10 08:33:56 00000001185335c0 INFO src/gitstatus.cc:157] argv[0]: "/private/var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.smeWizUq43/powerlevel10k/gitstatus/bin/gitstatusd-darwin-x86_64"
[2019-08-10 08:33:56 00000001185335c0 INFO src/gitstatus.cc:157] argv[1]: "--lock-fd=3"
[2019-08-10 08:33:56 00000001185335c0 INFO src/gitstatus.cc:157] argv[2]: "--parent-pid=59757"
[2019-08-10 08:33:56 00000001185335c0 INFO src/gitstatus.cc:157] argv[3]: "--num-threads=8"
[2019-08-10 08:33:56 00000001185335c0 INFO src/gitstatus.cc:157] argv[4]: "--max-num-staged=1"
[2019-08-10 08:33:56 00000001185335c0 INFO src/gitstatus.cc:157] argv[5]: "--max-num-unstaged=1"
[2019-08-10 08:33:56 00000001185335c0 INFO src/gitstatus.cc:157] argv[6]: "--max-num-conflicted=1"
[2019-08-10 08:33:56 00000001185335c0 INFO src/gitstatus.cc:157] argv[7]: "--max-num-untracked=1"
[2019-08-10 08:33:56 00000001185335c0 INFO src/gitstatus.cc:157] argv[8]: "--dirty-max-index-size=-1"
[2019-08-10 08:33:56 00000001185335c0 INFO src/gitstatus.cc:157] argv[9]: "--log-level=DEBUG"
[2019-08-10 08:33:56 00000001185335c0 INFO src/thread_pool.cc:81] Spawning 8 thread(s)
[2019-08-10 08:34:01 00000001185335c0 INFO src/request.cc:110] EOF. Exiting.

Your system information:

zsh:      5.7.1
uname -a: Darwin c4b301d3c8fd.ant.amazon.com 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64

If you need help, open an issue and attach this whole error message to it:

https://github.com/romkatv/gitstatus/issues/new

omarbaza@c4b301d3c8fd  /var/folders/bx/xdcq47c972j5ypgkgyknzs25gqnnkw/T/p10k.smeWizUq43 launchctl limit maxfiless  ✔  1  08:34:01 lsof -p $$ | wc -l lsof | wc -l maxfiles 256 unlimited 21

romkatv commented 5 years ago

The output from this command is missing:

lsof | wc -l

Could you send it?

romkatv commented 5 years ago

FYI: I'm going to put this on back burner for some time. As I mentioned, this sort of remote debugging where I cannot attach a debugger or strace things is extremely time consuming (think a full week of work), and I'm currently busy with other projects. If you figure out how your system is special so that I have at least some clue for the reasons fifos are broken, let me know.

omarbaza commented 5 years ago

lsof | wc -l

lsof | wc -l  ✔  2  11:13:27 8707

omarbaza commented 5 years ago

FYI: I'm going to put this on back burner for some time. As I mentioned, this sort of remote debugging where I cannot attach a debugger or strace things is extremely time consuming (think a full week of work), and I'm currently busy with other projects. If you figure out how your system is special so that I have at least some clue for the reasons fifos are broken, let me know.

No worries, I know is hard. thanks for the time you spent on this.

yukunlin commented 5 years ago

I made an experiment...

Previously I updated the zsh version of shell using brew and this instructions: https://rick.cogley.info/post/use-homebrew-zsh-instead-of-the-osx-default/

I rolled back those changes (using default zsh 5.3) uninstalling (brew uninstall zsh) and running "sudo dscl . -create /Users/$USER UserShell /bin/zsh"

I noticed that I'm not getting that error anymore... HOWEVER, it takes from 3-10 seconds to give me a prompt... that is pretty long isn't it?

I'm encountering the same issue as described in this thread.

@obazavil if you're willing to use the default system zsh (5.3) on macOS, this one line patch/hack in the powerlevel10k source fixed the slow load time for me:

diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 7ba7b69..4ee7e35 100755
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -4202,12 +4202,13 @@ _p9k_init() {
         gitstatus_start                              \
           -s $_POWERLEVEL9K_VCS_STAGED_MAX_NUM       \
           -u $_POWERLEVEL9K_VCS_UNSTAGED_MAX_NUM     \
           -d $_POWERLEVEL9K_VCS_UNTRACKED_MAX_NUM    \
           -c $_POWERLEVEL9K_VCS_CONFLICTED_MAX_NUM   \
           -m $_POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY \
+          -t 0.1 \
           POWERLEVEL9K || _POWERLEVEL9K_DISABLE_GITSTATUS=1
       fi
     fi
romkatv commented 5 years ago

@yukunlin Are you also using an Amazon-issued MacBook Pro?

romkatv commented 5 years ago

Can any of you check whether the following code works on your machine?

() {
  emulate -L zsh
  setopt err_return no_unset xtrace
  zmodload zsh/system

  local lock_file req_fifo resp_fifo
  local -i lock_fd=-1 daemon_pid=-1 req_fd=-1 resp_fd=-1

  {
    lock_file=$(mktemp ${TMPDIR:-/tmp}/lock.XXXXXXXXXX)
    zsystem flock -f lock_fd $lock_file
    req_fifo=$(mktemp -u ${TMPDIR:-/tmp}/req_fifo.XXXXXXXXXX)
    resp_fifo=$(mktemp -u ${TMPDIR:-/tmp}/resp_fifo.XXXXXXXXXX)
    mkfifo $req_fifo
    mkfifo $resp_fifo

    local cmd=$'
      echo $$
      read -t1 -rd "\x1e" msg
      echo -nE "${msg}\x1e"'
    cmd="cd /; zsh -dfxeuc ${(q)cmd} &!"
    zsh -dfmxeuc $cmd <$req_fifo >$resp_fifo 3<$lock_file &!

    sysopen -w -o cloexec,sync -u req_fd $req_fifo
    sysopen -r -o cloexec -u resp_fd $resp_fifo
    read -u $resp_fd daemon_pid
    rm -f $req_fifo $resp_fifo $lock_file

    function on-resp-hook() {}
    zle -F $resp_fd on-resp-hook

    local reply IFS=''
    echo -nE $'hello\x1f\x1e' >&$req_fd
    read -t1 -rd $'\x1e' -u $resp_fd reply
    [[ $reply == $'hello\x1f' ]]
    echo -E ${(%):-%2FSUCCESS%f}
  } always {
    unsetopt err_return
    (( resp_fd    > 0 )) && { zle -F $resp_fd; exec {resp_fd}>&- }
    (( req_fd     > 0 )) && exec {req_fd}>&-
    (( lock_fd    > 0 )) && zsystem flock -u $lock_fd
    (( daemon_pid > 0 )) && kill -- -$daemon_pid &>/dev/null
    (( $+functions[on-resp-hook] )) && unfunction on-resp-hook
    rm -f $lock_file $req_fifo $resp_fifo
  }
}

This is a stripped-down version of gitstatus initialization. It's supposed to exit with status 0 and to have green SUCCESS in its output. Try putting it in your ~/.zshrc and opening a bunch of terminal windows.

yukunlin commented 5 years ago

@yukunlin Are you also using an Amazon-issued MacBook Pro?

Yes, it may have something to do with how those laptops are setup; I don't have this issue on my personal machine. You can probably rule out different versions of macOS as a cause; my work machine is on 10.14, and @obazavil's is on 10.15

yukunlin commented 5 years ago

Can any of you check whether the following code works on your machine? .... .... This is a stripped-down version of gitstatus initialization. It's supposed to exit with status 0 and to have green SUCCESS in its output. Try putting it in your ~/.zshrc and opening a bunch of terminal windows.

Using the system zsh (5.3), it always succeeds. About 1 out of 10 times, there is a one second delay before the green SUCCESS appears.

Using the homebrew zsh (5.7.1), it fails intermittently, about 1 out of 5 times. Interestingly, the failures of the code above is independent of the failure of the gitstatus initialization of the prompt (which also fails about 1 out of 5 times).

romkatv commented 5 years ago

Yes, it may have something to do with how those laptops are setup

Back when I worked at Google, corp MacBooks were getting slower, buggier and more restrictive over time. Eventually they became virtually unusable and I switched to Linux.

I gave up debugging this issue because I suspected that Amazon's corp software is the culprit here and finding a workaround via remote debugging sessions will take too much time and effort. When you showed up, I was almost certain that Amazon-issued Mac is what makes the code fail. On the plus side this gave me hope that either of you might be tech-savvy and know some zsh and POSIX.

Using the homebrew zsh (5.7.1), it fails intermittently, about 1 out of 5 times. Interestingly, the failures of the code above is independent of the failure of the gitstatus initialization of the prompt (which also fails about 1 out of 5 times).

I wrote the self-contained ZSH snippet above in the hope that it will also exhibits the same issue. It's great that it does! If this snippet fails in the same way as gitstatus, you should see that read inside the background process times out with an error when using zsh 5.7.1. With 5.3 it also returns due to timeout but without an error.

Can you debug this code and find a workaround that makes it work with zsh 5.7.1? I don't have any special knowledge that you don't have, for this code is self-contained. I can answer your questions if you have any. The first thing I would recommend is removing as much code as you can. For example, that lock file is likely unnecessary. Perhaps double-fork is not needed either. Maybe one pipe is enough to trigger the bug, etc. I'll copy your workaround over to gitstatus if you succeed.

yukunlin commented 5 years ago

Thank you for your help so far. I’ll look further into this in my spare time.

romkatv commented 5 years ago

Here are a few things to try to save you time on debugging.

  1. Does this work?
() {
  emulate -L zsh
  setopt err_return no_unset xtrace no_monitor
  zmodload zsh/system

  local lock_file req_fifo resp_fifo
  local -i lock_fd=-1 daemon_pid=-1 req_fd=-1 resp_fd=-1

  {
    lock_file=$(mktemp ${TMPDIR:-/tmp}/lock.XXXXXXXXXX)
    zsystem flock -f lock_fd $lock_file
    req_fifo=$(mktemp -u ${TMPDIR:-/tmp}/req_fifo.XXXXXXXXXX)
    resp_fifo=$(mktemp -u ${TMPDIR:-/tmp}/resp_fifo.XXXXXXXXXX)
    mkfifo $req_fifo
    mkfifo $resp_fifo

    local cmd=$'
      echo $$
      read -t1 -rd "\x1e" msg
      echo -nE "${msg}\x1e"'
    cmd="cd /; zsh -dfxeuc ${(q)cmd} &!"
    zsh -dfmxeuc $cmd <$req_fifo >$resp_fifo 3<$lock_file &!

    sysopen -w -o cloexec,sync -u req_fd $req_fifo
    sysopen -r -o cloexec -u resp_fd $resp_fifo
    read -u $resp_fd daemon_pid
    rm -f $req_fifo $resp_fifo $lock_file

    function on-resp-hook() {}
    zle -F $resp_fd on-resp-hook

    local reply IFS=''
    echo -nE $'hello\x1f\x1e' >&$req_fd
    read -t1 -rd $'\x1e' -u $resp_fd reply
    [[ $reply == $'hello\x1f' ]]
    echo -E ${(%):-%2FSUCCESS%f}
  } always {
    unsetopt err_return
    (( resp_fd    > 0 )) && { zle -F $resp_fd; exec {resp_fd}>&- }
    (( req_fd     > 0 )) && exec {req_fd}>&-
    (( lock_fd    > 0 )) && zsystem flock -u $lock_fd
    (( daemon_pid > 0 )) && kill -- -$daemon_pid &>/dev/null
    (( $+functions[on-resp-hook] )) && unfunction on-resp-hook
    rm -f $lock_file $req_fifo $resp_fifo
  }
}
  1. If the above doesn't work, try this.
() {
  emulate -L zsh
  setopt err_return no_unset xtrace no_monitor
  zmodload zsh/system

  local req_fifo
  local -i daemon_pid=-1 req_fd=-1

  {
    req_fifo=$(mktemp -u ${TMPDIR:-/tmp}/req_fifo.XXXXXXXXXX)
    mkfifo $req_fifo

    local cmd=$'read -t1 -rd "\x1e" msg && [[ $msg == "hello\x1f" ]]'
    zsh -dfxeuc $cmd <$req_fifo &
    daemon_pid=$!

    sysopen -w -o cloexec,sync -u req_fd $req_fifo
    rm -f $req_fifo

    echo -nE $'hello\x1f\x1e' >&$req_fd
    wait $daemon_pid
    echo -E ${(%):-%2FSUCCESS%f}
  } always {
    unsetopt err_return
    (( req_fd     > 0 )) && exec {req_fd}>&-
    (( daemon_pid > 0 )) && kill -- $daemon_pid &>/dev/null
    rm -f $req_fifo
  }
}
  1. If the above doesn't work, try this.
() {
  emulate -L zsh
  setopt err_return no_unset xtrace no_monitor

  local req_fifo
  local -i daemon_pid=-1

  {
    req_fifo=$(mktemp -u ${TMPDIR:-/tmp}/req_fifo.XXXXXXXXXX)
    mkfifo $req_fifo

    local cmd=$'read -t1 -rd "\x1e" msg && [[ $msg == "hello\x1f" ]]'
    zsh -dfxeuc $cmd <$req_fifo &
    daemon_pid=$!

    echo -nE $'hello\x1f\x1e' >$req_fifo
    wait $daemon_pid
    echo -E ${(%):-%2FSUCCESS%f}
  } always {
    unsetopt err_return
    (( daemon_pid > 0 )) && kill -- $daemon_pid &>/dev/null
    rm -f $req_fifo
  }
}
  1. If the above doesn't work, try this.
() {
  emulate -L zsh
  setopt err_return no_unset xtrace no_monitor

  local req_fifo
  local -i daemon_pid=-1

  {
    req_fifo=$(mktemp -u ${TMPDIR:-/tmp}/req_fifo.XXXXXXXXXX)
    mkfifo $req_fifo

    local cmd=$'read -t1 msg && [[ $msg == hello ]]'
    zsh -dfxeuc $cmd <$req_fifo &
    daemon_pid=$!

    echo hello >$req_fifo
    wait $daemon_pid
    echo -E ${(%):-%2FSUCCESS%f}
  } always {
    unsetopt err_return
    (( daemon_pid > 0 )) && kill -- $daemon_pid &>/dev/null
    rm -f $req_fifo
  }
}
  1. If the above doesn't work, try this.
() {
  emulate -L zsh
  setopt err_return no_unset xtrace no_monitor

  local req_fifo
  local -i daemon_pid=-1

  {
    req_fifo=$(mktemp -u ${TMPDIR:-/tmp}/req_fifo.XXXXXXXXXX)
    mkfifo $req_fifo

    local cmd=$'read -t1 msg <'$req_fifo' && [[ $msg == hello ]]'
    zsh -dfxeuc $cmd &
    daemon_pid=$!

    echo hello >$req_fifo
    wait $daemon_pid
    echo -E ${(%):-%2FSUCCESS%f}
  } always {
    unsetopt err_return
    (( daemon_pid > 0 )) && kill -- $daemon_pid &>/dev/null
    rm -f $req_fifo
  }
}

This should narrow do the problem quite a bit. Please post the output from the last snippet that doesn't work.

romkatv commented 5 years ago

Thank you for your help so far. I’ll look further into this in my spare time.

Did you have a chance to run the snippets I posted in my last comment?

yukunlin commented 5 years ago

I tried running those snippets today and a week ago and observed some really strange behavior. Last week, 1 and 2 didn’t work, but 3 didn’t. However, going back to 1, that snippet stopped failing, and the problem described in this issue stopped happening.

Today, after restarting my machine, the issue started happening again, and snippet 1 would fail. Again, I tried snippet 3, which works consistently. However, after that, snippet 1 stopped failing.

Do these snippets have any side effects or set some global options? (It doesn’t seem like they do from my reading)

romkatv commented 5 years ago

Since (3) seems to work reliably, it might be not too hard to devise a workaround in gitstatus. Please run a few more experiments to narrow down the root cause of broken fifos. Execute these snippets in the specified order and let me know which ones work and which don't. As before, you'll probably need to execute each snippet many times to ensure it works.

2.1.

() {
  emulate -L zsh
  setopt err_return no_unset xtrace no_monitor
  zmodload zsh/system

  local req_fifo
  local -i daemon_pid=-1 req_fd=-1

  {
    req_fifo=$(mktemp -u ${TMPDIR:-/tmp}/req_fifo.XXXXXXXXXX)
    mkfifo $req_fifo

    local cmd=$'read -t1 -rd "\x1e" msg && [[ $msg == "hello\x1f" ]]'
    zsh -dfxeuc $cmd <$req_fifo &
    daemon_pid=$!

    sysopen -w -o cloexec,sync -u req_fd $req_fifo
    rm -f $req_fifo

    syswrite -o $req_fd $'hello\x1f\x1e'
    wait $daemon_pid
    echo -E ${(%):-%2FSUCCESS%f}
  } always {
    unsetopt err_return
    (( req_fd     > 0 )) && exec {req_fd}>&-
    (( daemon_pid > 0 )) && kill -- $daemon_pid &>/dev/null
    rm -f $req_fifo
  }
}

2.2.

() {
  emulate -L zsh
  setopt err_return no_unset xtrace no_monitor
  zmodload zsh/system

  local req_fifo
  local -i daemon_pid=-1 req_fd=-1

  {
    req_fifo=$(mktemp -u ${TMPDIR:-/tmp}/req_fifo.XXXXXXXXXX)
    mkfifo $req_fifo

    local cmd=$'read -t1 -rd "\x1e" msg && [[ $msg == "hello\x1f" ]]'
    zsh -dfxeuc $cmd <$req_fifo &
    daemon_pid=$!

    sysopen -w -o cloexec -u req_fd $req_fifo
    rm -f $req_fifo

    echo -nE $'hello\x1f\x1e' >&$req_fd
    wait $daemon_pid
    echo -E ${(%):-%2FSUCCESS%f}
  } always {
    unsetopt err_return
    (( req_fd     > 0 )) && exec {req_fd}>&-
    (( daemon_pid > 0 )) && kill -- $daemon_pid &>/dev/null
    rm -f $req_fifo
  }
}

2.3.

() {
  emulate -L zsh
  setopt err_return no_unset xtrace no_monitor
  zmodload zsh/system

  local req_fifo
  local -i daemon_pid=-1 req_fd=-1

  {
    req_fifo=$(mktemp -u ${TMPDIR:-/tmp}/req_fifo.XXXXXXXXXX)
    mkfifo $req_fifo

    local cmd=$'read -t1 -rd "\x1e" msg && [[ $msg == "hello\x1f" ]]'
    zsh -dfxeuc $cmd <$req_fifo &
    daemon_pid=$!

    exec {req_fd}>$req_fifo
    rm -f $req_fifo

    echo -nE $'hello\x1f\x1e' >&$req_fd
    wait $daemon_pid
    echo -E ${(%):-%2FSUCCESS%f}
  } always {
    unsetopt err_return
    (( req_fd     > 0 )) && exec {req_fd}>&-
    (( daemon_pid > 0 )) && kill -- $daemon_pid &>/dev/null
    rm -f $req_fifo
  }
}

Do these snippets have any side effects or set some global options?

No. These snippets create a fifo and spawn a background zsh. The foreground zsh writes "hello" to the fifo and the background zsh is supposed to read "hello" from it. All snippets are valid and supposed to work on any POSIX-compliant system. On your system the background zsh sometimes cannot read anything from the fifo. I believe is caused by bugs in low-level meddling done by the corpware that is meant to protect and audit your machine. It could also be caused by bugs in zsh or libc that only get exposed when your corpware is present.

pdelre commented 5 years ago

I just came across this issue as well. I've run 2.1, 2.2, and 2.3 several times over. None seem to be successful 100%, but all seem to have a similar success rate (~80% guesstimate).

romkatv commented 5 years ago

@pdelre Are you using a corporate macbook from Apple?

Can you confirm that (2) in https://github.com/romkatv/gitstatus/issues/54#issuecomment-522912756 doesn't work while (3) does?

pdelre commented 5 years ago

(3) was much more successful. I thought the first run failed but couldn't reproduce a second failure, so I might have had a copy/paste issue in the first.

I am using a corporate MBP provisioned by my company. We use both a low level system management tool and a virus scanner.


I've attempted the (2.x) versions again and they were all successful. Could be any policy checking has completed since I was first running them.

romkatv commented 5 years ago

I am using a corporate MBP provisioned by my company.

And your company isn't Amazon?

Can you ask your corporate IT staff for help? Maybe they can explain what's going on and what I should change to have fifos working the way they are supposed to work? Or maybe they'll suggest some other IPC (unix domain sockets?) that's less upsetting to the surveillance software they deploy?

Otherwise I'm inclined to close this issue and to point fingers at your OS provider. I'm willing to implement a workaround but without my being able to reproduce the problem I'll need someone to tell me which workaround to implement.

pdelre commented 5 years ago

And your company isn't Amazon?

Correct.

I'll touch base with our IT and point some folks here. We use a highly popular Apple Device Management platform but I'm not sure what's published information.

romkatv commented 5 years ago

Any updates on this issue, anyone?

pdelre commented 5 years ago

@romkatv No luck with our IT and Security teams. They did not find anything in my audit logs that would point to a cause or most likely workaround.

romkatv commented 5 years ago

They did not find anything in my audit logs that would point to a cause or most likely workaround.

That's disappointing.

If I understand correctly, snippet 2.1 from https://github.com/romkatv/gitstatus/issues/54#issuecomment-526168779 doesn't work reliably on the system your IT staff provisions. It uses a total of four programs: zsh, mktemp, mkfifo and rm. All of these come preinstalled on macOS. Given that this problem is reproducible, it should be possible to provide some insight into the nature of the problem. One way would be to quickly try different variations of this code to try to pinpoint the conditions that trigger the bug. Another is to strace zsh (or whatever the equivalent is on macOS) and compare traces from a successful and unsuccessful runs of the snippet. Yet another is to attach a debugger to zsh to see where data sent over fifos gets stuck.

If any of you are engineers, perhaps you can give it a try? There is only that much I can do without being able to reproduce this issue myself.

pdelre commented 5 years ago

@romkatv I believe I'm tapped out for now. I spent a few hours trying to regularly reproduce the issue to dig into the workarounds. I'm at a point where it isn't reproducing as it was when I first posted and given the IT services involved, I can't force it to happen either.

I'll return if the issue comes up for me again and I can get actionable information.