runtime(tar): fix lz4 extraction on non-Linux systems
Commit:
https://github.com/vim/vim/commit/b0ce576fbc7af4a33226a8d076a01aadd024a23e
Author: Vladimír Marek <
vlma...@gmail.com>
Date: Thu Jun 18 19:12:40 2026 +0000
runtime(tar): fix lz4 extraction on non-Linux systems
Patch 9.2.0306 fixed malformed lz4 extraction commands by using "tar -I lz4"
on Linux and leaving non-Linux tar implementations to auto-detect lz4 input.
That still fails on systems where tar does not support either -I lz4 or
automatic lz4 decompression, such as Solaris /usr/bin/tar.
Keep the existing Linux path using GNU tar's "-I lz4" support. For non-Linux
systems, use lz4 explicitly to decompress the archive to stdout and feed the
resulting tar stream to the configured tar extraction command. This is the
same style tar.vim already used for lz4 archives before patch 9.2.0306.
Follow-up for #19925
closes: #20555
Signed-off-by: Vladimír Marek <
vlma...@gmail.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim
index 3c899f85f..7f8e24ac0 100644
--- a/runtime/autoload/tar.vim
+++ b/runtime/autoload/tar.vim
@@ -26,6 +26,7 @@
" 2026 Apr 15 by Vim Project: fix more path traversal issues (#19981)
" 2026 Apr 16 by Vim Project: use g:tar_secure in tar#Extract()
" 2026 May 14 by Vim Project: use correct shellescape() call in Vimuntar()
+" 2026 Jun 16 by Vim Project: fix lz4 extraction on non-linux systemd (#20555)
"
" Contains many ideas from Michael Toren's <tar.vim>
"
@@ -129,7 +130,7 @@ let g:tar_leading_pat='\m^\%([.]\{,2\}/\)\+'
fun! s:Msg(func, severity, msg)
redraw!
if a:severity =~? 'error'
- echohl Error
+ echohl Error
else
echohl WarningMsg
endif
@@ -733,8 +734,10 @@ fun! tar#Extract()
elseif tarball =~# "\.tlz4$"
if has("linux")
let extractcmd= substitute(extractcmd,"-","-I lz4 -","")
+ call system(extractcmd." ".shellescape(tarball)." ".g:tar_secure.shellescape(fname))
+ else
+ call system("lz4 --decompress --stdout -- ".shellescape(tarball)." | ".extractcmd." - ".g:tar_secure.shellescape(fname))
endif
- call system(extractcmd." ".shellescape(tarball)." ".g:tar_secure.shellescape(fname))
if v:shell_error != 0
call s:Msg('tar#Extract', 'error', $"{extractcmd} {tarball} {fname}: failed!")
else
@@ -744,8 +747,10 @@ fun! tar#Extract()
elseif tarball =~# "\.tar\.lz4$"
if has("linux")
let extractcmd= substitute(extractcmd,"-","-I lz4 -","")
+ call system(extractcmd." ".shellescape(tarball)." ".g:tar_secure.shellescape(fname))
+ else
+ call system("lz4 --decompress --stdout -- ".shellescape(tarball)." | ".extractcmd." - ".g:tar_secure.shellescape(fname))
endif
- call system(extractcmd." ".shellescape(tarball)." ".g:tar_secure.shellescape(fname))
if v:shell_error != 0
call s:Msg('tar#Extract', 'error', $"{extractcmd} {tarball} {fname}: failed!")
else