Narrow zip to the deflate codec by default - #91
Open
rtb-12 wants to merge 1 commit into
Open
Conversation
Owner
|
hi @rtb-12, this LGTM but I do think it's worth noting in the changelog. If you can update that I'll get this merged and released. |
zip's default features enable every codec it supports. Only deflate is needed for the archives this crate extracts, so pull it with default-features off and add a zip-all-codecs feature that restores the rest.
rtb-12
force-pushed
the
zip-default-features
branch
from
September 1, 2026 16:37
b566ad2 to
e8598ba
Compare
Author
|
Thanks changelog added under Unreleased, and I dropped the explanatory comment from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
zip = "8.0"picks up zip's default feature set, which enables every compression codec it supports: bzip2, deflate64, lzma, ppmd, zstd, xz, plus aes-crypto. That is ~19 transitive crates compiled into every downstream consumer, for codecscached-pathnever selects itself - extraction just callsZipArchive::extractand decodes whatever the archive contains.This narrows the default to deflate (with
timekept for entry timestamps), and adds azip-all-codecsfeature that restores zip's full default set for consumers who extract archives using the other codecs. That mirrors how tar.xz/lzma support is already opt-in through the existinglzmafeature.Motivation beyond build weight: bzip2 0.6 resolves to
libbz2-rs-sys, which carries thebzip2-1.0.6license. Downstream projects with license allowlists (cargo-deny) now hit that via cached-path -> zip -> bzip2 even though no bzip2 code path is reachable for them.For a consumer whose archives are all deflate zips or tar.gz, this removes the bzip2/zstd/xz/ppmd/aes stacks from the graph entirely.
cargo testpasses with the narrowed features, includingtest_extract_zip.Note: for a consumer that does extract bzip2/zstd/xz zips today, this default change means enabling
zip-all-codecs(or the specific zip feature) when upgrading - flagging it in case you prefer that called out in the changelog as a breaking change for 0.11.