vim/backport-runtime-Fix-for-FreeBSD-unzip-command.patch
2025-03-19 16:39:04 +08:00

64 lines
2.5 KiB
Diff

From f0e9b72c8fdd47b9b410a11edf7479953cb2aed9 Mon Sep 17 00:00:00 2001
From: Damien <141588647+xrandomname@users.noreply.github.com>
Date: Mon, 5 Aug 2024 20:21:18 +0200
Subject: [PATCH] runtime(zip): Fix for FreeBSD's unzip command
Problem: Cannot browse zipfiles with the unzip program found
on FreeBSD.
Solution: Adjust command arguments.
Unzip found on FreeBSD complain about missing argument with the
zipinfo modifier '-Z -1'. Joining arguments seems to work
for both implementations.
Also change `:sil!` to `:sil` so that error messages are properly
reported (per review of Christian Brabandt).
related: #15411
Signed-off-by: Damien <141588647+xrandomname@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
---
runtime/autoload/zip.vim | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim
index e8973e3c80cc8a..8876ef08e60500 100644
--- a/runtime/autoload/zip.vim
+++ b/runtime/autoload/zip.vim
@@ -1,11 +1,12 @@
" zip.vim: Handles browsing zipfiles
" AUTOLOAD PORTION
-" Date: Jul 23, 2024
+" Date: Aug 05, 2024
" Version: 33
" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" Last Change:
" 2024 Jul 23 by Vim Project: fix 'x' command
" 2024 Aug 04 by Vim Project: escape '[' in name of file to be extracted
+" 2024 Aug 05 by Vim Project: workaround for the FreeBSD's unzip
" License: Vim License (see vim's :help license)
" Copyright: Copyright (C) 2005-2019 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
@@ -138,7 +139,7 @@ fun! zip#Browse(zipfile)
keepj $
" call Decho("exe silent r! ".g:zip_unzipcmd." -l -- ".s:Escape(a:zipfile,1))
- exe "keepj sil! r! ".g:zip_unzipcmd." -Z -1 -- ".s:Escape(a:zipfile,1)
+ exe $"keepj sil r! {g:zip_unzipcmd} -Z1 -- {s:Escape(a:zipfile, 1)}"
if v:shell_error != 0
redraw!
echohl WarningMsg | echo "***warning*** (zip#Browse) ".fnameescape(a:zipfile)." is not a zip file" | echohl None
@@ -246,7 +247,7 @@ fun! zip#Read(fname,mode)
let temp = tempname()
" call Decho("using temp file<".temp.">")
let fn = expand('%:p')
- exe "sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp
+ exe "sil !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fname,1).' > '.temp
" call Decho("exe sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp)
sil exe 'keepalt file '.temp
sil keepj e!
--
2.43.0