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

error: unable to unpack tarball to temporary directory: EndOfStream #20256

Open
hazeycode opened this issue Jun 10, 2024 · 9 comments
Open

error: unable to unpack tarball to temporary directory: EndOfStream #20256

hazeycode opened this issue Jun 10, 2024 · 9 comments
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@hazeycode
Copy link
Sponsor Contributor

hazeycode commented Jun 10, 2024

Zig Version

0.13.0-dev.351+64ef45eb0

Steps to Reproduce and Observed Behavior

zig fetch --save https://github.com/zig-gamedev/system-sdk/archive/refs/tags/v0.2.0.tar.gz
error: unable to unpack tarball to temporary directory: EndOfStream

Expected Behavior

Package is downloaded and build.zig.zon dependency entry is added.

@hazeycode hazeycode added the bug Observed behavior contradicts documented or intended behavior label Jun 10, 2024
@squeek502
Copy link
Collaborator

I get Unexpected end of data when trying to extract with 7-zip.

@hazeycode
Copy link
Sponsor Contributor Author

Weird. I can open and extract this archive using the Windows 11 File Explorer builtin thing and with tar on Linux but not with the builtin thing on MacOS 14.5.

@Paul-Dempsey
Copy link

Windows 11 recent updates added more compression formats.

@hazeycode
Copy link
Sponsor Contributor Author

hazeycode commented Jun 11, 2024

Even weirder, I downloaded from the same url twice and got 2 different results on macOS (no Zig involved). One is 42.6 MB and the other is 3.5 MB.

https://github.com/zig-gamedev/system-sdk/archive/refs/heads/main.tar.gz if anyone wants to try it.

Something is truncating the archives so I'll close this on the basis that this is not a Zig issue.

@hazeycode
Copy link
Sponsor Contributor Author

hazeycode commented Jun 11, 2024

A similar issue: NixOS/nix#4533

Maybe Zig could prompt to retry the download if the archive can't be unpacked?

@hippietrail
Copy link

Maybe zig fetch is not correctly detecting that the download fails and/or not checking that actual and expected download lengths match before trying to unpack. Could also be the server not (correctly) reporting download aborting or expected length.

@marler8997
Copy link
Contributor

Even weirder, I downloaded from the same url twice and got 2 different results on macOS (no Zig involved). One is 42.6 MB and the other is 3.5 MB.
https://github.com/zig-gamedev/system-sdk/archive/refs/heads/main.tar.gz if anyone wants to try it.

That URL you linked is pointing to the main branch which does change.

@hazeycode
Copy link
Sponsor Contributor Author

hazeycode commented Jun 12, 2024

That URL you linked is pointing to the main branch which does change.

You can download from the url multiple times without the main branch changing. Sometimes the archive is truncated and other times it isn't. See #20256 (comment)

@rofrol
Copy link
Contributor

rofrol commented Jun 12, 2024

In case of the server or proxy server is SIGKILLed during data transfer, Linux kernel will terminated the TCP connection by FIN+ACK. And if the server doesn't provide Content-Length (eg. GitHub tarball archive URLs), our current behavior is to exit without error, leaving incomplete data.

curl/curl#6736

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

6 participants