compinitのセキュリティオプション

.zshrcに補完のために以下の設定をする。

autoload -U compinit;
compinit

ここでセキュリティ警告が出る場合があります。

Ignore insecure directories and continue [ny]?

こんなの。

これを回避するには上記の設定を以下のようにします。

autoload -U compinit;
compinit -u

で、-uオプションは何か。というか設定して一年位してやっと調べる気になった。

man zshcompsys に載ってました。
zsh のオプションって manではinlineで書いてあるので読みにくい。。。

前略
compinit
中略

For security reasons compinit also checks if the completion system would use files not owned by root
or by the current user, or files in directories that are world- or group-writable or that are not
owned by root or by the current user. If such files or directories are found, compinit will ask if
the completion system should really be used. To avoid these tests and make all files found be used
without asking, use the option -u, and to make compinit silently ignore all insecure files and direc-
tories use the option -i. This security check is skipped entirely when the -C option is given.
後略

拙訳
セキュリティのために、compinitは以下のことをチェックします。
・補完システムが使用するファイルの所有者がrootか現在のユーザ以外であるか
・ファイルが入っているディレクト
パーミッション:誰でも書き込み可能もしくはグループ書き込み可能か
・rootもしくは現在のユーザ以外が所有しているか
以上のようなファイルやディレクトリを発見すると、compinitが補完システムを使用
するか聞いてきます。関連して以下のオプションがあります。

-u : 上記のテストを避けて、すべての発見したファイルを警告なしに使用する
-i : すべての安全でないファイルとディレクトリを無視する
-C : セキュリティチェック全体をスキップする

ということでした。