fix(init): check for unsafe directories in `fpath` (#10672)
Diff
1diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
2index ab32ee9d3ea6282271462e7cbe36b5defbf17652..925ee46aaa3467c8b3e82e462cb5213b9dd159a1 100644
3--- a/oh-my-zsh.sh
4+++ b/oh-my-zsh.sh
5@@ -120,17 +120,18 @@ fi
6 7 if [[ "$ZSH_DISABLE_COMPFIX" != true ]]; then
8 source "$ZSH/lib/compfix.zsh"
9- # If completion insecurities exist, warn the user
10- handle_completion_insecurities
11 # Load only from secure directories
12- compinit -i -C -d "$ZSH_COMPDUMP"
13+ compinit -i -d "$ZSH_COMPDUMP"
14+ # If completion insecurities exist, warn the user
15+ handle_completion_insecurities &|
16 else
17 # If the user wants it, load from all found directories
18- compinit -u -C -d "$ZSH_COMPDUMP"
19+ compinit -u -d "$ZSH_COMPDUMP"
20 fi
2122 # Append zcompdump metadata if missing
23-if (( $zcompdump_refresh )); then
24+if (( $zcompdump_refresh )) \
25+ || ! command grep -q -Fx "$zcompdump_revision" "$ZSH_COMPDUMP" 2>/dev/null; then
26 # Use `tee` in case the $ZSH_COMPDUMP filename is invalid, to silence the error
27 # See https://github.com/ohmyzsh/ohmyzsh/commit/dd1a7269#commitcomment-39003489
28 tee -a "$ZSH_COMPDUMP" &>/dev/null <<EOF