[macOS General] VCS_INFO_detect_p4:79: maximum nested function level reached; increase FUNCNEST? というエラーが Zsh ログイン直後に表示される
Zsh を v5.7 にバージョンアップ後にログインするとエラーが表示されました。
“`prettyprinted
% zsh –version
zsh 5.7 (x86_64-apple-darwin18.2.0)
“`
## 症状
`VCS_INFO_detect_p4:79: maximum nested function level reached; increase FUNCNEST?` というエラーが表示されます。
再帰しているようです。
“`prettyprinted
Last login: Tue Jan 29 16:39:54 on ttys003
VCS_INFO_detect_p4:79: maximum nested function level reached; increase FUNCNEST?
[foo@mba] ~
“`
下記のような設定があると発生します。
> * [少し凝った zshrc](https://gist.github.com/mollifier/4979906)
“`bash:~/.zshrc
function _update_vcs_info_msg() {
LANG=en_US.UTF-8 vcs_info
RPROMPT=”${vcs_info_msg_0_}”
}
add-zsh-hook precmd _update_vcs_info_msg
“`
## 調査
v5.7 で `vcs_info` に変更が加えられたようです。
> vcs_info git: The gen-unapplied-string hook receives the patches in order (next to be applied first). This is consistent with the hg backend and with one of two contradictory claims in the documentation (the other one has been corrected). In zsh through 5.6.2, the patches were passed in reverse order, next to be applied being last in the array. The gen-applied-string hook is unaffected; it still receives the patches in reverse order, from last applied to first applied.
>
> [ZSH – Release Notes](http://zsh.sourceforge.net/releases.html)
既に fix されたようなので、次期バージョンで解決しそうです。
> * [zsh / Code / Commit [b70919]](https://sourceforge.net/p/zsh/code/ci/b70919e0d9dadc93893e9d18bc3ef13b88756ecf/)
## 対処
それまでは該当する `add-zsh-hook` 行をコメントアウトしておきます。
追記:2019/02/01
`brew update`, `brew upgrade zsh` で解消していることを確認しました。
## 補遺
> * [FS#61533 : [zsh][5.7] VCS_INFO_detect_p4:79: maximum nested function level reached; increase FUNCNEST? on start](https://bugs.archlinux.org/task/61533)
> * [[PATCH] Fix broken VCS_Info in 5.7](http://www.zsh.org/mla/workers//2019/msg00058.html)