zdharma-continuum / zinit

🌻 Flexible and fast ZSH plugin manager
MIT License
2.99k stars 127 forks source link

[bug]: compinit insecure directories warning can not be silenced. #558

Closed cocoonkid closed 11 months ago

cocoonkid commented 1 year ago

What happened?

image

I have at the beginning of my .zshrc autoload -Uz compinit bashcompinit && compinit -u && bashcompinit && zmodload -i zsh/complist the -u works here apparently but as soon as

if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
    print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
    command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
    command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \
        print -P "%F{33} %F{34}Installation successful.%f%b" || \
        print -P "%F{160} The clone has failed.%f%b"
fi

source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"

autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit

I get the prompt again.

I am running this in an automated fashion for a multiuser system so the directories are known and the risk is accepted.

but no matter what I tried I cannot silence the warning appearing when sourcing the zinit.sh

I also tried ZSH_DISABLE_COMPFIX=true in various sourced files, as export , in seperate files sourced at the beginning.

Please let me know how I can silence it globally for zinit.

Operating System & Version

OS: linux-gnu | Vendor: pc | Machine: x86_64 | CPU: x86_64 | Processor: unknown | Hardware: x86_64

Zsh version

zsh 5.9 (x86_64-pc-linux-gnu)

Terminal emulator

xterm-256color

cocoonkid commented 1 year ago

I found Znap allows something like

zstyle '*:compinit' arguments -D -i -u -C -w

vladdoster commented 1 year ago

@cocoonkid,

This is possible in Zinit as well and is documented in the README.md.

Screenshot 2023-09-30 at 7 08 42 PM
typeset -gAH ZINIT=(HOME_DIR "$HOME/.local/share/zinit" COMPINIT_OPTS '-D -i -u -C -w')

if [[ ! -e "$ZINIT[HOME_DIR]/zinit.git/zinit.zsh" ]]; then
    print -P "%F{33}%F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
    command mkdir -p "$ZINIT[HOME_DIR]" && command chmod g-rwX "$ZINIT[HOME_DIR]"
    command git clone https://github.com/zdharma-continuum/zinit "$ZINIT[HOME_DIR]/zinit.git" && \
        print -P "%F{33}%F{34}Installation successful.%f%b" || \
        print -P "%F{160}The clone has failed.%f%b"
fi

source "$ZINIT[HOME_DIR]/zinit.git/zinit.zsh"

autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
vladdoster commented 12 months ago

@cocoonkid,

Did my suggestion resolve the issue?

vladdoster commented 11 months ago

@cocoonkid,

Closing issue due to lack of activity. Please open a new issue if the issue persists.