Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting FreeBSD kernel tarball creates /boot/kernel/GNUSparseFile.0/kernel #34

Open
rwp0 opened this issue May 31, 2022 · 1 comment

Comments

@rwp0
Copy link

rwp0 commented May 31, 2022

Extracting FreeBSD kernel tarball compressed with XZ renames

./boot/kernel/kernel to ./boot/kernel/GNUSparseFile.0/kernel

which means contains_file and extract_file methods no longer work with file not found error.

https://download.freebsd.org/ftp/releases/amd64/13.1-RELEASE/kernel.txz

Testing with:

use v5.32; use Archive::Tar;
say for Archive::Tar -> new('/opt/13.1/kernel.txz') -> list_files;

and tar tf '/opt/13.1/kernel.txz' we get the following difference:

422c422
< ./boot/kernel/kernel
---
> ./boot/kernel/GNUSparseFile.0/kernel

while both bsdtar and gtar (GNU tar) can list and extract

# tar --version
bsdtar 3.4.2 - libarchive 3.4.2 zlib/1.2.11 liblzma/5.2.5 bz2lib/1.0.8 

# gtar --version
tar (GNU tar) 1.34

I've installed the following FreeBSD packages before running A:T, of course (for XZ support):

  • p5-Archive-Tar: 2.40
  • p5-Compress-Raw-Bzip2: 2.101
  • p5-Compress-Raw-Lzma: 2.101
  • p5-Compress-Raw-Zlib: 2.101
  • p5-IO-Compress: 2.101
  • p5-IO-Compress-Lzma: 2.101
  • p5-IO-String: 1.08_1

There's some info on sparse files, but I don't understand what is it, and what makes A:T do that while the CLI utilities list and extract properly.

https://www.gnu.org/software/tar/manual/html_section/Sparse-Formats.html
https://www.gnu.org/software/tar/manual/html_node/Sparse-Recovery.html


using Perl version 5.32.0

@h3xx
Copy link
Contributor

h3xx commented Feb 1, 2023

It also extracts to the wrong path, creating boot/kernel/GNUSparseFile.0/kernel whereas gnu tar creates boot/kernel/kernel.

Searching thru that particular archive, I see:

...^@^@^@^@^@^@^@^@^@27 mtime=1652339437.749802
22 GNU.sparse.major=1
22 GNU.sparse.minor=0
40 GNU.sparse.name=./boot/kernel/kernel
32 GNU.sparse.realsize=29343680
...^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@./boot/kernel/GNUSparseFile.0/kernel^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@000555 ^@000000 ^@000000 ^@00157340700 14237131355 017533^@ 0^@^@...

Where ^@ is less(1)'s representation of NUL.

This makes me think this was created with a version of tar that is using an older version of tar's sparse file format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants