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

[Bug]: "invalid Zip archive: Could not find central directory end" on Linux #770

Closed
1 task done
stevenlele opened this issue Aug 19, 2024 · 10 comments
Closed
1 task done
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@stevenlele
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

https://github.com/stevenlele/winget-update/actions/runs/10461236814/job/28969123177

I've tested that it works correctly on Windows.

@stevenlele stevenlele added bug Something isn't working help wanted Extra attention is needed labels Aug 19, 2024
@russellbanks
Copy link
Owner

russellbanks commented Aug 19, 2024

This should be fixed in Komac v2.4.0 as there has been lots of fixes to do with the central directory in the zip library that komac uses.

I'll leave this open to confirm that that's the case.

@stevenlele
Copy link
Author

I've tried a release build with zip upgraded to v2.1.6 but it still doesn't work. Debug builds work in some conditions.

@stevenlele
Copy link
Author

@russellbanks
Copy link
Owner

Well, with Komac v2.4.0 it even panicked.

Thanks for the quick test @stevenlele. This issue wasn't to do with the zip but occured when fetching an existing pull request. I've released v2.4.1 to address this.

@stevenlele
Copy link
Author

Now back to "invalid Zip archive: No valid central directory found" again.

https://github.com/stevenlele/winget-update/actions/runs/10511819731/job/29123663650

@russellbanks
Copy link
Owner

Now back to "invalid Zip archive: No valid central directory found" again.

This is as expected. I'll report this to the underlying library as it works on Windows and presumably macOS.

@Okeanos
Copy link

Okeanos commented Aug 29, 2024

I can confirm that it does not in fact work on macOS:

Using https://github.com/tamasfe/taplo/releases/download/0.9.3/taplo-full-windows-x86.zip as an example will yield

Error:
   0: invalid Zip archive: No valid central directory found

@russellbanks
Copy link
Owner

russellbanks commented Aug 30, 2024

Could you possibly test a nightly build, please? I reckon that this is potentially because on unix systems, the end of the file download may be being stored in a buffer and not being fully written before it gets read. For most files this issue wouldn't arise but to read the central directory, you need to read at the end of the file. I've made a commit that ensures that the download has been fully written to disk before proceeding.

@stevenlele
Copy link
Author

Nice, it's working now.

https://github.com/stevenlele/winget-update/actions/runs/10638632733/job/29495015000#step:2:16

@Okeanos
Copy link

Okeanos commented Aug 30, 2024

I can also confirm that it works on macOS as well using the nightly build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants