Open mripard opened 5 months ago
Hi, I wrote that code (in https://github.com/ostreedev/ostree-rs-ext/ ).
Before I forget I also have some larger questions about what you're thinking of doing with that linked tool https://github.com/mripard/ocibootstrap and its overlap/intersection with http://github.com/containers/bootc and especially bootc install
...but those are all side questions better done perhaps as an issue on your repository.
So it looks to me that tar-rs is a bit to cautious there, or at least more that GNU tar is, and we could possibly relax (with an option?) tar-rs ?
Without digging in deeply here I think that's possible...but it needs some deeper analysis. First, long link support here is relatively new and it's entirely possible I missed something.
Actually of important note here is that for how ostree actually uses these we don't call unpack_in
...and in fact the unit test I added only re-parses the tarball.
Handling symlinks during unpacking (especially being robust against malicious tar) is a longstanding issue here (previously https://github.com/alexcrichton/tar-rs/pull/90 etc).
I will say personally my view is that the maximally safe and robust way to handle this is using e.g. https://github.com/bytecodealliance/cap-std - I thought about making that an optional dependency here.
Also I see another issue here which may be a dup of this one or related: https://github.com/alexcrichton/tar-rs/issues/369
Hi,
I've been trying to write a tool that fetches container images and extracts them. Containers are stored as multiple tar.gz files that need to be decompressed in sequence.
It looks like tar-rs struggles to decompress some of those archives, for a reason that isn't entirely clear to me yet:
I've made a test tool that just tries to decompress a tar.gz archive using the same code, and can reproduce the issue:
tar works just fine:
If I have a look at the output from tar though, it appears that
usr/lib/.build-id/91/319a27e0de0f6d6f0606ca103fa52f5ab78601
is a symlink:And
a63fafc9ae2c7b25dbdf4dba215d4e0a7a3f9136c5b1e02bfa767da611d965.file
seems to be a symlink to the same file, but a broken one:It makes sense for this link to be broken because ostree deploys the actual files as hardlinks to their stored objects under ostree/repo.
And sure enough, in the tar version:
The '/usr/lib
one ends up a hardlink to the one under 'sysroot/ostree/repo
, but the link is only valid under/usr/lib
, and the one undersysroot
is kind of expected to be broken.So it looks to me that
tar-rs
is a bit to cautious there, or at least more that GNU tar is, and we could possibly relax (with an option?)tar-rs
?