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

bsdtar: "Truncated tar archive: Unknown error" on extracting archive containing sparse file #2138

Open
M-a-r-k opened this issue Apr 22, 2024 · 5 comments

Comments

@M-a-r-k
Copy link

M-a-r-k commented Apr 22, 2024

I'm using version 3.7.3 of bsdtar on Windows 10 x64.

After creating a tar archive containing a single sparse file, there is an issue on extracting it. A (possibly bogus?) error message is shown, but it seems that the complete file is extracted correctly.

>bsdtar --version
bsdtar 3.7.3 - libarchive 3.7.3 zlib/1.3 liblzma/5.4.4 bz2lib/1.1.0 libzstd/1.5.5


>bsdtar.exe -vScf test3.tar NetBSD_10.0_4GB_HD.bin
a NetBSD_10.0_4GB_HD.binbsdtar.exe: (null)


>bsdtar.exe -vxf test3.tar
x NetBSD_10.0_4GB_HD.bin: Truncated tar archive: Unknown error
bsdtar.exe: Error exit delayed from previous errors.

The tar archive (compressed with Zip) is attached. ~3MB.
test3_tar.zip

@kientzle
Copy link
Contributor

This is the same issue already reported in #2125

@M-a-r-k
Copy link
Author

M-a-r-k commented Apr 24, 2024

Oh, I assumed the issue was different, since in this case bsdtar does extract the file correctly (extracted size 4,000,000,000 bytes). Whereas in #2125 the file was corrupted on extraction with no error message.

@kientzle kientzle reopened this Apr 27, 2024
@kientzle
Copy link
Contributor

This is different, actually. This file is in GNU pax sparse format 1.0.

To double-check my understanding, this file was created by bsdtar on Windows 10? It does indeed appear to be subtly malformed. I'll have to dig into it a bit to try to figure out how this happened. Thanks for reporting it.

@M-a-r-k
Copy link
Author

M-a-r-k commented Apr 27, 2024

I used bsdtar 3.7.3 on Windows (10 and 11) to create and extract the archive. Hopefully you can reproduce the issue by just extracting it, then using the commands I pasted above.

@M-a-r-k
Copy link
Author

M-a-r-k commented Apr 27, 2024

Another point of information...

If when creating the archive you specify more than one file, the second and subsequent files are not actually added to the archive! For example:

> echo "Hi Tim!!!" >hello.txt
> echo "this is a sample" >sample.txt
> bsdtar -vScf oops.tar NetBSD_10.0_4GB_HD.bin hello.txt sample.txt
a NetBSD_10.0_4GB_HD.binbsdtar: (null)

The archive created is missing the two text files.

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