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

Sparse files handled incorrectly #37

Open
h3xx opened this issue Feb 1, 2023 · 0 comments
Open

Sparse files handled incorrectly #37

h3xx opened this issue Feb 1, 2023 · 0 comments

Comments

@h3xx
Copy link
Contributor

h3xx commented Feb 1, 2023

I noticed that Archive::Tar doesn't extract sparse files correctly, when the tarball is created using tar c --sparse -f file.tar sparse.dat

Steps to repro:

# Make a sparse file that looks to all readers to contain 10MB of NUL bytes
rm -f my-sparse-file
truncate -s 10M my-sparse-file

# This must return 0 or you're likely on a file system that does not support
# sparse files.
du my-sparse-file

# This should give the logical file size, 10,485,760 bytes
ls -l my-sparse-file

tar c --sparse -f tar-with-sparse.tar my-sparse-file

# This, likewise, should give the same number of bytes as ls(1)
tar tvf tar-with-sparse.tar

rm -f my-sparse-file
perl -MArchive::Tar -e 'Archive::Tar->extract_archive("tar-with-sparse.tar");'

The my-sparse-file will be created with a 0-byte size (should be 10,485,760).

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

1 participant