From 4fd38b34e76fb97fb20d2345256e80526a4921c8 Mon Sep 17 00:00:00 2001 From: Andrea Alberti Date: Sun, 15 Feb 2026 18:10:33 +0100 Subject: [PATCH] fix: prevent double extraction when exclamation mark modifier is used in extract'!' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using extract'!' with from'gh-r', ziextract was called twice: 1. First by the gh-r download code (line 407) — extracting the archive directly 2. Then by the ∞zinit-extract-hook — calling ziextract --auto --move On the second call, the .tar.gz was already gone, so --auto mode fell through to file-command detection, which identified .jar files as zip archives and tried to extract them — corrupting the plugin and producing errors. Fix: Both the gh-r download path (line 407) and the tarball path (line 272) now skip their direct ziextract call when the extract ice is set, deferring entirely to the ∞zinit-extract-hook which handles it correctly. --- zinit-install.zsh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/zinit-install.zsh b/zinit-install.zsh index 813550e7..cb3da2da 100644 --- a/zinit-install.zsh +++ b/zinit-install.zsh @@ -267,9 +267,11 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || { } } - # --move is default (or as explicit, when extract'!…' is given) - # Also possible is --move2 when extract'!!…' given - ziextract "$fname" ${ICE[extract]---move} ${${(M)ICE[extract]:#!([^!]|(#e))*}:+--move} ${${(M)ICE[extract]:#!!*}:+--move2} + # When extract ice is set, the ∞zinit-extract-hook will handle + # extraction; otherwise extract here with --move as default. + if (( !${+ICE[extract]} )); then + ziextract "$fname" --move + fi return 0 ) && { reply=( "$user" "$plugin" ) @@ -397,7 +399,11 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || { [[ -d ._zinit ]] || return 2 builtin print -r -- $url >! ._zinit/url || return 3 builtin print -r -- ${REPLY} >! ._zinit/is_release${count:#1} || return 4 - ziextract ${REPLY:t} ${${${#reply}:#1}:+--nobkp} ${${(M)ICE[extract]:#!([^!]|(#e))*}:+--move} ${${(M)ICE[extract]:#!!*}:+--move2} + # When extract ice is set, the ∞zinit-extract-hook will + # handle extraction; otherwise extract here (no move). + if (( !${+ICE[extract]} )); then + ziextract ${REPLY:t} ${${${#reply}:#1}:+--nobkp} + fi } return $? ) || {