Commit: runtime(zip): fix failure on Windows CI
Christian Brabandt <[email protected]> Thu, 30 Jul 2026 22:30:04 +0200
| Newsgroups | gmane.editors.vim.devel |
|---|---|
| Message-ID | <[email protected]> |
runtime(zip): fix failure on Windows CI Commit: https://github.com/vim/vim/commit/e241ac0a62b774763733f2ccac4040dfe8aafac8 Author: Christian Brabandt <[email protected]> Date: Thu Jul 30 20:22:52 2026 +0000 runtime(zip): fix failure on Windows CI Problem: The zip autoload script aborts loading when the "zip" command is not available, so even read-only browsing of an archive fails with E117 (zip#Browse undefined) on systems that have "unzip" but not "zip" (e.g. the Windows CI runner). Regressed in b0e0b22. Solution: Drop the load-time executable gate and check each command per operation instead, so a missing "zip" only affects writing. Update the test to match the reworded message. Signed-off-by: Christian Brabandt <[email protected]> diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim index 1d0ecff45..61e980743 100644 --- a/runtime/autoload/zip.vim +++ b/runtime/autoload/zip.vim @@ -114,22 +114,17 @@ endfun " sanity checks " s:SafeExecutable: {{{2 fun! s:SafeExecutable(exe) - if !executable(a:exe) && !s:isPS() - call s:Mess('Error', "***error*** (zip) '".a:exe."' not available on your system") + " fails when exe is a full path with spaces + let exe = substitute(a:exe, '\s\+.*$', '', '') + if !executable(exe) && !s:isPS() return v:false endif - if !dist#vim#IsSafeExecutable('zip', a:exe) && !s:isPS() - call s:Mess('Error', "Warning: NOT executing " .. a:exe .. " from current directory!") + if !dist#vim#IsSafeExecutable('zip', exe) && !s:isPS() + call s:Mess('Error', "Warning: NOT executing " .. a:exe .. " from current directory!") return v:false endif return v:true endfun -" guarantee default command is exist and not be injected by environment -" every default command should be checked -if !s:SafeExecutable(g:zip_zipcmd) | finish | endif -if !s:SafeExecutable(g:zip_unzipcmd) | finish | endif -if !s:SafeExecutable(g:zip_extractcmd) | finish | endif - " ---------------- " PowerShell: {{{1 " ---------------- @@ -260,8 +255,8 @@ fun! zip#Browse(zipfile) defer s:RestoreOpts(dict) " sanity checks - if !executable(g:zip_unzipcmd) && !s:isPS() - call s:Mess('Error', "***error*** (zip#Browse) unzip not available on your system") + if !s:SafeExecutable(g:zip_unzipcmd) + call s:Mess('Error', "***error*** (zip#Browse) sorry, your system doesn't appear to have the ".g:zip_unzipcmd." program") return endif if !filereadable(a:zipfile) @@ -368,7 +363,7 @@ fun! zip#Read(fname,mode) endif let fname = fname->substitute('[', '[[]', 'g')->escape('?*\') " sanity check - if !executable(substitute(g:zip_unzipcmd,'\s\+.*$','','')) && !s:isPS() + if !s:SafeExecutable(g:zip_unzipcmd) call s:Mess('Error', "***error*** (zip#Read) sorry, your system doesn't appear to have the ".g:zip_unzipcmd." program") return endif @@ -404,7 +399,7 @@ fun! zip#Write(fname) defer s:RestoreOpts(dict) " sanity checks - if !executable(substitute(g:zip_zipcmd,'\s\+.*$','','')) && &shell !~ 'pwsh' + if !s:SafeExecutable(g:zip_zipcmd) call s:Mess('Error', "***error*** (zip#Write) sorry, your system doesn't appear to have the ".g:zip_zipcmd." program") return endif @@ -532,6 +527,13 @@ fun! zip#Extract() let dict = s:SetSaneOpts() defer s:RestoreOpts(dict) + + " sanity checks + if !s:SafeExecutable(g:zip_extractcmd) + call s:Mess('Error', "***error*** (zip#Extract) sorry, your system doesn't appear to have the ".g:zip_extractcmd." program") + return + endif + let fname= getline(".") " sanity check diff --git a/src/testdir/test_plugin_zip.vim b/src/testdir/test_plugin_zip.vim index 435713154..c46a3efc0 100644 --- a/src/testdir/test_plugin_zip.vim +++ b/src/testdir/test_plugin_zip.vim @@ -86,7 +86,7 @@ def g:Test_zip_basic() ### Check opening zip when "unzip" program is missing var save_zip_unzipcmd = g:zip_unzipcmd g:zip_unzipcmd = "/" - assert_match('unzip not available on your system', execute("e X.zip")) + assert_match('(zip#Browse) sorry, your system doesn''t appear to have the / program', execute("e X.zip")) ### Check when "unzip" don't work if executable("false") -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1wpXOG-004gAF-Rp%40256bit.org.