JuliaIO / Tar.jl

TAR files: create, list, extract them in pure Julia
MIT License
79 stars 19 forks source link

Unsupported entry type: hardlink #101

Closed maleadt closed 3 years ago

maleadt commented 3 years ago
julia> using ArtifactUtils

julia> add_artifact!(
                  "Artifacts.toml",
                  "ubuntu",
                  "https://partner-images.canonical.com/core/focal/20210414/ubuntu-focal-core-cloudimg-amd64-root.tar.gz",
                  force=true,
              )
ERROR: unsupported entry type
Tar.Header("usr/bin/bzcat", :hardlink, 0o755, 0, "usr/bin/bunzip2")

I was trying to use a rootfs tarball as an artifact, but it seems to contain a hardlink which results in Tar.jl unable to process it.

StefanKarpinski commented 3 years ago

Yup, Tar doesn't support hard links. We possibly could, but it's a bit of a significant feature.

maleadt commented 3 years ago

I decided to work around it: https://github.com/JuliaCI/PkgEval.jl/blob/0cd947e632f5986cab203b1e596de1e5d804117a/rootfs/debian.sh#L27-L36. I thought it might have been an oversight since there's some traces of it in the code base, e.g.: https://github.com/JuliaIO/Tar.jl/blob/ddca32996e7f1c8cf5a249056c2c0d83af395074/src/header.jl#L93-L94

StefanKarpinski commented 3 years ago

I'm digging into how hard links work in tarballs, which is not entirely obvious. If it's possible to support extracting them without too much trouble, I could add the feature, but I have to figure out how they work first.

StefanKarpinski commented 3 years ago

So it turns out that this isn't that hard to implement but it's very tricky to make sure that extracting the tarball does't do anything dangerous with some combination of symlinks and hard links.