[release/10.0-preview2] Revert "version needed to extract" fix #112923
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #112922 to release/10.0-preview2
/cc @carlossanlop
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 #112017).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 (unmodified) entries isn’t rewritten by us (because we didn’t modify them), leading now 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 that fix 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 @ViktorHofer @artl93
Customer Impact
Regression
Regression introduced with #112032 which is what we're reverting here.
Testing
Revert to previous behavior which was working fine with other tools like 7zip.
Risk
Low. We know the previous behavior worked as expected and the dotnet/android team has a workaround.