Fix double extraction when extract ice is used with from'gh-r'#761
Fix double extraction when extract ice is used with from'gh-r'#761alberti42 merged 3 commits intozdharma-continuum:mainfrom
extract ice is used with from'gh-r'#761Conversation
|
@vladdoster Let me know if you need a minimal repro to test this bug and how it is fixed. |
|
@vladdoster You had started to look into it. Do you need anything from me? Perhaps you could start reproducing the bug? I find this patch super useful. Because the feature was not documented and broken, I did not know it existed for a long time. So, when I was installing apps/plugins from the GitHub releases, I always had to manually move the files in |
|
Would be nice to have zunit tests for these, but other than that lgtm. |
Yes, indeed. Good idea. I will create some tests. |
d12d49d to
687df15
Compare
cd662a1 to
4611bad
Compare
… in extract'!' 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.
… was so far completely missing)
@pschmitt I added the new tests and further improved documentation for the ice If I understood it correctly, there is a bug upstream in I filed an igorshubovych/markdownlint-cli#606. It passes all tests. I dare to merge this PR. Hopefully no regression of any kind. 🤞 |
Problem
When using
extract'!'(orextract'!!') together withfrom'gh-r', the downloaded archive was extracted twice:ziextractcall in the gh-r download code∞zinit-extract-hook, which runs at!atclone-preOn the second pass, the original archive no longer exists (it was deleted after the first extraction). The
--autodetection then falls back to thefilecommand, which identifies unrelated files (e.g.,.jarfiles, which are technically zip archives) and attempts to extract them — producing errors and potentially corrupting the plugin directory.Example error output:
The same issue also affected the tarball download path.
Root cause
The bug went unnoticed because
extract'!'was typically used with cloned repositories (where only the hook runs), not withfrom'gh-r'releases (where both the inline call and the hook run).Fix
Guard the inline
ziextractcalls in both the gh-r and tarball download paths so they only run when theextractice is not set. When the ice is set, the∞zinit-extract-hookhandles extraction exclusively, avoiding the duplication.Documentation
Updated the
extractice description inREADME.mdto document the previously undocumented prefix modifiers:extractextract'!'extract'!!'extract'-'extract'!file.tar.gz'