Skip to content

Narrow zip to the deflate codec by default - #91

Open
rtb-12 wants to merge 1 commit into
epwalsh:mainfrom
rtb-12:zip-default-features
Open

Narrow zip to the deflate codec by default#91
rtb-12 wants to merge 1 commit into
epwalsh:mainfrom
rtb-12:zip-default-features

Conversation

@rtb-12

@rtb-12 rtb-12 commented Aug 31, 2026

Copy link
Copy Markdown

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 codecs cached-path never selects itself - extraction just calls ZipArchive::extract and decodes whatever the archive contains.

This narrows the default to deflate (with time kept for entry timestamps), and adds a zip-all-codecs feature 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 existing lzma feature.

Motivation beyond build weight: bzip2 0.6 resolves to libbz2-rs-sys, which carries the bzip2-1.0.6 license. 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 test passes with the narrowed features, including test_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.

@epwalsh

epwalsh commented Sep 1, 2026

Copy link
Copy Markdown
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
rtb-12 force-pushed the zip-default-features branch from b566ad2 to e8598ba Compare September 1, 2026 16:37
@rtb-12

rtb-12 commented Sep 1, 2026

Copy link
Copy Markdown
Author

Thanks changelog added under Unreleased, and I dropped the explanatory comment from Cargo.toml since the entry now carries that context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants