-
Notifications
You must be signed in to change notification settings - Fork 5k
Revert "version needed to extract" fix #112922
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
Revert "version needed to extract" fix #112922
Conversation
…ntral and local directories when updating entries. This reverts commit 68a88d1.
Tagging subscribers to this area: @dotnet/area-system-io-compression |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (3)
src/libraries/System.IO.Compression/tests/ZipArchive/zip_InvalidParametersAndStrangeFiles.cs:907
- [nitpick] Removal of the 'ZipArchive_InvalidVersionToExtract' test reduces coverage for verifying the consistency between local file headers and central directory headers; please consider adding alternative tests if this functionality remains supported.
[Fact]
src/libraries/System.IO.Compression/tests/ZipArchive/zip_InvalidParametersAndStrangeFiles.cs:928
- The comment uses 'UNcompressed' with unexpected capitalization; consider using 'uncompressed' for consistency.
// UNcompressed size
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs:1245
- Reverting the update to the 'Changes' flag in VersionToExtractAtLeast may reintroduce inconsistencies between the local file header and central directory header; please verify that this reversion fully aligns with the intended behavior in Update mode.
Changes |= ZipArchive.ChangeState.FixedLengthMetadata;
/backport to release/10.0-preview2 |
Started backporting to release/10.0-preview2: https://github.com/dotnet/runtime/actions/runs/13529959006 |
/ba-g The nativeaot leg is stuck |
Reverts #112032
This reverts commit 68a88d1.
The dotnet/android team uses a tool called
aapt2
to create zip files. The entries added by this tool set a “version needed to extract” metadata field with a value of 0.0. But sometimes this tool uses deflate compression, which requires a version of 2.0, which they don’t set correctly (full discussion in original issue).When these zip files are then opened using our
ZipArchive
inUpdate
mode and new entries are added to the archive, the central directory is correctly updated with the correct version, but the local file header for existing entries isn’t rewritten by us, leading to a mismatch.We tried to fix this by forcing the local file header to be rewritten when the “version needed to extract” changes, ensuring consistency between the local file header and the central directory header. Unfortunately, this attempt to increase correctness made matters worse, as tools like 7zip now report that the zip files are corrupt.
So this PR reverts this change to avoid breaking other tools when they open zip files with this issue that are then modified by our
ZipArchive
.The dotnet/android team has a workaround: instead of using
aapt2
they can use a tool calledandroid-libzipsharp
, which has the drawback of being less performant, but it works fine.@edwardneal @jonathanpeppers @ericstj