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

Fix zip file opening twice #42337

Merged
merged 1 commit into from
May 14, 2021
Merged

Conversation

zaevi
Copy link
Contributor

@zaevi zaevi commented Sep 25, 2020

Fixes #42329
Fixes #48697

@akien-mga akien-mga added this to the 4.0 milestone Sep 25, 2020
@akien-mga akien-mga added the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Sep 25, 2020
@akien-mga
Copy link
Member

I wonder if it's correct to remove this one. godot_open is the one that minizip will call internally, and godot_close is used to close the handle. Maybe it's the other open that we should remove or properly close, before letting minizip do its own logic of open/read/close? I'm not familiar with the internals of minizip though so maybe it's not necessary.

@akien-mga
Copy link
Member

See also core/io/zip_io.cpp which uses a similar pattern where the zopen_file function will call FileAccess::open (but there the opaque FileAccess data is not open beforehand).

@zaevi
Copy link
Contributor Author

zaevi commented Sep 25, 2020

See also core/io/zip_io.cpp which uses a similar pattern where the zopen_file function will call FileAccess::open (but there the opaque FileAccess data is not open beforehand).

Oh, this is proper in logic. I will modify for this

@akien-mga
Copy link
Member

Note that ZipArchive::try_open_pack likely has the same issue of double open too.

@akien-mga
Copy link
Member

I just noticed that there's also this PR which relates to the same code, probably trying to solve a similar issue: #40303. This code is a bit tricky as I don't know any current maintainer who is familiar with this code, so it's hard to assess changes.

@zaevi zaevi requested a review from a team as a code owner May 14, 2021 05:54
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with the minizip API and the pros/cons of switching from using the opaque pointers to the stream ones. But the implementation seems good and it fixes an important bug, so unless anyone objects the changes, I'll merge. (Poke @reduz @punto- @RandomShaper)

@RandomShaper
Copy link
Member

LGTM.

@akien-mga akien-mga merged commit fcbf714 into godotengine:master May 14, 2021
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

Cherry-picked for 3.4.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label May 14, 2021
@zaevi zaevi deleted the fix-zip-open-twice branch May 14, 2021 11:06
@akien-mga
Copy link
Member

Cherry-picked for 3.3.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants