Diff
1diff --git a/lib/compfix.zsh b/lib/compfix.zsh
2index 208aaadb1ebad0e25ebdef29192da815be8136bd..68decc1ed4d6fc5b51476fc9224f0d0171e96804 100644
3--- a/lib/compfix.zsh
4+++ b/lib/compfix.zsh
5@@ -2,10 +2,6 @@
6 # insecure ownership or permissions) by:
7 #
8 # * Human-readably notifying the user of these insecurities.
9-# * Moving away all existing completion caches to a temporary directory. Since
10-# any of these caches may have been generated from insecure directories, they
11-# are all suspect now. Failing to do so typically causes subsequent compinit()
12-# calls to fail with "command not found: compdef" errors. (That's bad.)
13 function handle_completion_insecurities() {
14 # List of the absolute paths of all unique insecure directories, split on
15 # newline from compaudit()'s output resembling:
16@@ -22,39 +18,27 @@ function handle_completion_insecurities() {
17 insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )
18
19 # If no such directories exist, get us out of here.
20- if (( ! ${#insecure_dirs} )); then
21- print "[oh-my-zsh] No insecure completion-dependent directories detected."
22- return
23- fi
24+ (( ! ${#insecure_dirs} )) && return
25
26 # List ownership and permissions of all insecure directories.
27 print "[oh-my-zsh] Insecure completion-dependent directories detected:"
28 ls -ld "${(@)insecure_dirs}"
29- print "[oh-my-zsh] For safety, completions will be disabled until you manually fix all"
30- print "[oh-my-zsh] insecure directory permissions and ownership and restart oh-my-zsh."
31- print "[oh-my-zsh] See the above list for directories with group or other writability.\n"
32
33- # Locally enable the "NULL_GLOB" option, thus removing unmatched filename
34- # globs from argument lists *AND* printing no warning when doing so. Failing
35- # to do so prints an unreadable warning if no completion caches exist below.
36- setopt local_options null_glob
37+ cat <<EOD
38
39- # List of the absolute paths of all unique existing completion caches.
40- local -aU zcompdump_files
41- zcompdump_files=( "${ZSH_COMPDUMP}"(.) "${ZDOTDIR:-${HOME}}"/.zcompdump* )
42+[oh-my-zsh] For safety, we will not load completions from these directories until
43+[oh-my-zsh] you fix their permissions and ownership and restart zsh.
44+[oh-my-zsh] See the above list for directories with group or other writability.
45
46- # Move such caches to a temporary directory.
47- if (( ${#zcompdump_files} )); then
48- # Absolute path of the directory to which such files will be moved.
49- local ZSH_ZCOMPDUMP_BAD_DIR="${ZSH_CACHE_DIR}/zcompdump-bad"
50+[oh-my-zsh] To fix your permissions you can do so by disabling
51+[oh-my-zsh] the write permission of "group" and "others" and making sure that the
52+[oh-my-zsh] owner of these directories is either root or your current user.
53+[oh-my-zsh] The following command may help:
54+[oh-my-zsh] compaudit | xargs chmod g-w,o-w
55
56- # List such files first.
57- print "[oh-my-zsh] Insecure completion caches also detected:"
58- ls -l "${(@)zcompdump_files}"
59+[oh-my-zsh] If the above didn't help or you want to skip the verification of
60+[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
61+[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.
62
63- # For safety, move rather than permanently remove such files.
64- print "[oh-my-zsh] Moving to \"${ZSH_ZCOMPDUMP_BAD_DIR}/\"...\n"
65- mkdir -p "${ZSH_ZCOMPDUMP_BAD_DIR}"
66- mv "${(@)zcompdump_files}" "${ZSH_ZCOMPDUMP_BAD_DIR}/"
67- fi
68+EOD
69 }