Skip to content

Commit 7327631

Browse files
KenoKristofferC
authored andcommitted
Fix 7z extraction when path has symlink/.. (#4538)
7z appears to normalize internally causing it to fail to extract archives that have this pattern. One way to reproduce is to set DEPOT_PATH to a path that has a symlink/.. in the path. We get this wrong in Julia too, c.f. JuliaLang/julia#60251 (cherry picked from commit 52d7fa3)
1 parent 861187f commit 7327631

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/PlatformEngines.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,9 @@ Get the decompression command for a tarball by detecting format via magic bytes.
495495
"""
496496
function get_extract_cmd(tarball_path::AbstractString)
497497
format = detect_archive_format(tarball_path)
498+
# 7z appears to normalize paths internally, which can cause mis-resolution
499+
# if symbolic links are present
500+
tarball_path = realpath(tarball_path)
498501
if format == "zstd"
499502
return `$(exezstd()) -d -c $tarball_path`
500503
else

0 commit comments

Comments
 (0)