From a4613ecea5b06de846e655d1988f07fe881b25a2 Mon Sep 17 00:00:00 2001 From: Jonny Yu Date: Fri, 16 Oct 2026 23:00:10 -0700 Subject: [PATCH 1/2] Enable LZMA (method 14) compression for zip archives Co-Authored-By: Claude Sonnet 5.5 --- Cargo.lock | 30 +++++++++++++++++++++++++++++- Cargo.toml | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 84ed3be..1f9f758 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -296,6 +296,12 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" +[[package]] +name = "const-oid" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" + [[package]] name = "constant_time_eq" version = "0.4.2" @@ -440,6 +446,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" dependencies = [ "block-buffer 0.12.1", + "const-oid", "crypto-common 0.2.2", "ctutils", ] @@ -485,7 +492,7 @@ dependencies = [ "rand", "serde", "serde_json", - "sha2", + "sha2 0.10.9", "snapbox", "tar", "tempfile", @@ -779,6 +786,15 @@ version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" +[[package]] +name = "lzma-rust2" +version = "0.16.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca93e534d1142d1d0dcca6d25fe302508a5dfb40b302802904577725ea0b695b" +dependencies = [ + "sha2 0.11.0", +] + [[package]] name = "memchr" version = "2.8.3" @@ -1123,6 +1139,17 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "sha2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "digest 0.11.3", +] + [[package]] name = "shlex" version = "2.0.1" @@ -1600,6 +1627,7 @@ dependencies = [ "crc32fast", "flate2", "indexmap", + "lzma-rust2", "memchr", "typed-path", "zopfli", diff --git a/Cargo.toml b/Cargo.toml index e816701..7daf47d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ sha2 = "0.10.6" tar = "0.4.46" tempfile = "3.27.0" thiserror = "2.0.21" -zip = { version = "8.6.0", features = ["deflate"], default-features = false } +zip = { version = "8.6.0", features = ["deflate", "lzma"], default-features = false } zstd = { version = "0.14.0", features = ["experimental", "zstdmt"] } [dev-dependencies] From 6f86e24a8db7a47f3994d103c3d0f9f56162e44a Mon Sep 17 00:00:00 2001 From: Jonny Yu Date: Fri, 16 Oct 2026 23:01:50 -0700 Subject: [PATCH 2/2] Add zip LZMA unarchive test and document supported zip methods Co-Authored-By: Claude Sonnet 5.5 --- src/util/testdata/lzma.zip | Bin 0 -> 193 bytes src/util/unarchive.rs | 20 ++++++++++++++++++++ website/docs/dotslash-file.md | 3 +++ 3 files changed, 23 insertions(+) create mode 100644 src/util/testdata/lzma.zip diff --git a/src/util/testdata/lzma.zip b/src/util/testdata/lzma.zip new file mode 100644 index 0000000000000000000000000000000000000000..e28df803717580d8ea334ed9baf949258d8d79d4 GIT binary patch literal 193 zcmWIWW@fQxU}E57P}>m@TND}dT9bi+A%cm4ffGn)q~_%0>y=cLNHMcA#4-o~g-j$p z-}Sx}>B?GqZQIVudk)3>+NAVOmTXJ^|GzVWfg!+~k;$F`mx(Gs13*9lOd^@j1r=gs hkYLdHo%G^Q>|I8v8aNf;&B_MiFalvTkPZOL000v5D1ZO} literal 0 HcmV?d00001 diff --git a/src/util/unarchive.rs b/src/util/unarchive.rs index 4a48a62..6305c46 100644 --- a/src/util/unarchive.rs +++ b/src/util/unarchive.rs @@ -149,3 +149,23 @@ where archive.set_preserve_mtime(true); archive.unpack(destination_dir) } + +#[cfg(all(test, not(dotslash_internal)))] +mod tests { + use std::io::Cursor; + + use super::*; + + #[test] + fn unarchive_zip_lzma() { + // Created with `7z a -tzip -mm=LZMA`, so the entry uses zip compression + // method 14. + let zip = Cursor::new(&include_bytes!("testdata/lzma.zip")[..]); + let dest = tempfile::tempdir().unwrap(); + unarchive(zip, dest.path(), ArchiveType::Zip).unwrap(); + assert_eq!( + std::fs::read_to_string(dest.path().join("hello.txt")).unwrap(), + "hello lzma zip\n".repeat(40), + ); + } +} diff --git a/website/docs/dotslash-file.md b/website/docs/dotslash-file.md index a9e949e..fcbc9da 100644 --- a/website/docs/dotslash-file.md +++ b/website/docs/dotslash-file.md @@ -399,6 +399,9 @@ properties: | `zst` | no | zstd | | _omitted_ | no | _none_ | +A `zip` archive can use the store, deflate, or LZMA (method 14) compression +methods for its entries. + An artifact is either an _archive_ (such as a `.tar` file) or a _single file_. ### Path