[macOS General] VCS_INFO_detect_p4:79: maximum nested function level reached; increase FUNCNEST? というエラーが Zsh ログイン直後に表示される

Zsh を v5.7 にバージョンアップ後にログインするとエラーが表示されました。

% zsh --version
zsh 5.7 (x86_64-apple-darwin18.2.0)

Contents

症状

VCS_INFO_detect_p4:79: maximum nested function level reached; increase FUNCNEST? というエラーが表示されます。
再帰しているようです。

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
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

既に fix されたようなので、次期バージョンで解決しそうです。

対処

それまでは該当する add-zsh-hook 行をコメントアウトしておきます。

追記:2019/02/01
brew update, brew upgrade zsh で解消していることを確認しました。

補遺