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

Unpacking file size is incorrect (with reproduced repo) #286

Open
axetroy opened this issue Mar 14, 2022 · 4 comments · May be fixed by #298
Open

Unpacking file size is incorrect (with reproduced repo) #286

axetroy opened this issue Mar 14, 2022 · 4 comments · May be fixed by #298

Comments

@axetroy
Copy link

axetroy commented Mar 14, 2022

And here is the reproduced repo: https://github.com/axetroy/libflate-66

git clone https://github.com/axetroy/libflate-66
cd ./libflate-66
cargo run ./

# View unpacked files ’prune‘

The origin file size is : 985,384
The unzip file size is : 965,416

  1. unpack with Tar

size = 965,416

  1. unpack with python3

size = 985,384

>>> import tarfile
>>> tar = tarfile.open("prune_darwin_amd64.tar")
>>> tar.getmember("prune").size
985384
  1. unpack with build-in tar tools in macOS

size = 985,384

ref: sile/libflate#66

@axetroy axetroy changed the title Unpacking file size is incorrect Unpacking file size is incorrect (with reproduced repo) Mar 14, 2022
@alexcrichton
Copy link
Owner

Running locally:

$ cargo run -q --example raw_list < ./prune_darwin_amd64.tar
-------------------------- Entry 0
path: PaxHeader/prune
size: 128
entry size: 128
link name: None
file type: 0x78
mode: 0o755
uid: 501
gid: 20
mtime: 1645982337
username: Some("runner")
groupname: Some("staff")
kind: UStar
pax extensions:
        "mtime" = "1645982337.98713127"
        "GNU.sparse.major" = "1"
        "GNU.sparse.minor" = "0"
        "GNU.sparse.name" = "prune"
        "GNU.sparse.realsize" = "985384"
-------------------------- Entry 1
path: GNUSparseFile.0/prune
size: 965416
entry size: 965416
link name: None
file type: 0x30
mode: 0o755
uid: 501
gid: 20
mtime: 1645982337
username: Some("runner")
groupname: Some("staff")
kind: UStar

It appears that this is using a pax extension for the real size that isn't supported by this crate.

@axetroy
Copy link
Author

axetroy commented Mar 14, 2022

Did you say that the Tar format is incorrect?

What do I need to do?

@axetroy
Copy link
Author

axetroy commented Mar 15, 2022

Before resolving this, I decompressed executable files that have lost some information and cannot be executed.

And my temporary solution:

Priority use the TAR command in the system to decompress

@NobodyXu
Copy link

I think #298 will fix this.

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

Successfully merging a pull request may close this issue.

3 participants