My zsh configuration
git clone https://github.com/m-col/zshrc
Files | Refs | Readme

-rw-r--r-- oh-my-zsh/compfix.zsh


      1 # Handle completions insecurities (i.e., completion-dependent directories with
      2 # insecure ownership or permissions) by:
      3 #
      4 # * Human-readably notifying the user of these insecurities.
      5 function handle_completion_insecurities() {
      6   # List of the absolute paths of all unique insecure directories, split on
      7   # newline from compaudit()'s output resembling:
      8   #
      9   #     There are insecure directories:
     10   #     /usr/share/zsh/site-functions
     11   #     /usr/share/zsh/5.0.6/functions
     12   #     /usr/share/zsh
     13   #     /usr/share/zsh/5.0.6
     14   #
     15   # Since the ignorable first line is printed to stderr and thus not captured,
     16   # stderr is squelched to prevent this output from leaking to the user. 
     17   local -aU insecure_dirs
     18   insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )
     19 
     20   # If no such directories exist, get us out of here.
     21   (( ! ${#insecure_dirs} )) && return
     22 
     23   # List ownership and permissions of all insecure directories.
     24   print "[oh-my-zsh] Insecure completion-dependent directories detected:"
     25   ls -ld "${(@)insecure_dirs}"
     26 
     27   cat <<EOD
     28 
     29 [oh-my-zsh] For safety, we will not load completions from these directories until
     30 [oh-my-zsh] you fix their permissions and ownership and restart zsh.
     31 [oh-my-zsh] See the above list for directories with group or other writability.
     32 
     33 [oh-my-zsh] To fix your permissions you can do so by disabling
     34 [oh-my-zsh] the write permission of "group" and "others" and making sure that the
     35 [oh-my-zsh] owner of these directories is either root or your current user.
     36 [oh-my-zsh] The following command may help:
     37 [oh-my-zsh]     compaudit | xargs chmod g-w,o-w
     38 
     39 [oh-my-zsh] If the above didn't help or you want to skip the verification of
     40 [oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
     41 [oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.
     42 
     43 EOD
     44 }
     45