" 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>
"
fun! s:Msg(func, severity, msg)
redraw!
if a:severity =~? 'error'
- echohl Error
+ echohl Error
else
echohl WarningMsg
endif
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
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