From 60afee4d0a0fca0a8a85be0b88644fbec3186698 Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Wed, 30 Oct 2024 14:13:25 -0700 Subject: [PATCH 1/3] Upgrade zip to 2.2.0 --- Cargo.lock | 82 ++++++++++++++++++++++++++++++++++-- Cargo.toml | 2 +- tufaceous-lib/src/archive.rs | 17 +++++--- workspace-hack/Cargo.toml | 2 + 4 files changed, 93 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 87899e699c..9381faf1c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -178,6 +178,15 @@ dependencies = [ "num-traits", ] +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +dependencies = [ + "derive_arbitrary", +] + [[package]] name = "arc-swap" version = "1.7.1" @@ -2111,6 +2120,17 @@ dependencies = [ "syn 2.0.79", ] +[[package]] +name = "derive_arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "derive_builder" version = "0.20.2" @@ -2307,6 +2327,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d305e5a3904ee14166439a70feef04853c1234226dbb27ede127b88dc5a4a9d" +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "dlpi" version = "0.2.0" @@ -3248,7 +3279,7 @@ dependencies = [ "usdt", "uuid", "version_check", - "zip", + "zip 0.6.6", ] [[package]] @@ -3957,7 +3988,7 @@ dependencies = [ "toml 0.7.8", "x509-cert", "zerocopy 0.6.6", - "zip", + "zip 0.6.6", ] [[package]] @@ -4978,6 +5009,12 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "lockfree-object-pool" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" + [[package]] name = "log" version = "0.4.22" @@ -7125,6 +7162,7 @@ dependencies = [ "x509-cert", "zerocopy 0.7.35", "zeroize", + "zip 0.6.6", ] [[package]] @@ -10220,6 +10258,12 @@ dependencies = [ "libc", ] +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + [[package]] name = "similar" version = "2.6.0" @@ -11838,7 +11882,7 @@ dependencies = [ "toml 0.8.19", "tough", "url", - "zip", + "zip 2.2.0", ] [[package]] @@ -13175,6 +13219,24 @@ dependencies = [ "flate2", ] +[[package]] +name = "zip" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc5e4288ea4057ae23afc69a4472434a87a2495cafce6632fd1c4ec9f5cf3494" +dependencies = [ + "arbitrary", + "bzip2", + "crc32fast", + "crossbeam-utils", + "displaydoc", + "flate2", + "indexmap 2.6.0", + "memchr", + "thiserror", + "zopfli", +] + [[package]] name = "zone" version = "0.1.8" @@ -13244,3 +13306,17 @@ dependencies = [ "quote", "syn 1.0.109", ] + +[[package]] +name = "zopfli" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946" +dependencies = [ + "bumpalo", + "crc32fast", + "lockfree-object-pool", + "log", + "once_cell", + "simd-adler32", +] diff --git a/Cargo.toml b/Cargo.toml index 4fe0f4deac..e4dfb41cc1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -632,7 +632,7 @@ wicket-common = { path = "wicket-common" } wicketd-api = { path = "wicketd-api" } wicketd-client = { path = "clients/wicketd-client" } zeroize = { version = "1.8.1", features = ["zeroize_derive", "std"] } -zip = { version = "0.6.6", default-features = false, features = ["deflate","bzip2"] } +zip = { version = "2.2.0", default-features = false, features = ["deflate","bzip2"] } zone = { version = "0.3", default-features = false, features = ["async"] } # newtype-uuid is set to default-features = false because we don't want to diff --git a/tufaceous-lib/src/archive.rs b/tufaceous-lib/src/archive.rs index 9440db5a4c..675cba7eee 100644 --- a/tufaceous-lib/src/archive.rs +++ b/tufaceous-lib/src/archive.rs @@ -14,7 +14,10 @@ use std::{ fmt, io::{BufReader, BufWriter, Cursor, Read, Seek}, }; -use zip::{write::FileOptions, CompressionMethod, ZipArchive, ZipWriter}; +use zip::{ + write::{FileOptions, SimpleFileOptions}, + CompressionMethod, ZipArchive, ZipWriter, +}; /// A builder for TUF repo archives. #[derive(Debug)] @@ -65,18 +68,20 @@ impl ArchiveBuilder { Ok(()) } - pub fn finish(mut self) -> Result<()> { - let zip_file = self.writer.finish().with_context(|| { - format!("error finalizing archive at `{}`", self.output_path) + pub fn finish(self) -> Result<()> { + let Self { writer, output_path } = self; + + let zip_file = writer.0.finish().with_context(|| { + format!("error finalizing archive at `{}`", output_path) })?; zip_file.into_inner().with_context(|| { - format!("error writing archive at `{}`", self.output_path) + format!("error writing archive at `{}`", output_path) })?; Ok(()) } - fn file_options() -> FileOptions { + fn file_options() -> SimpleFileOptions { // The main purpose of the zip archive is to transmit archives that are // already compressed, so there's no point trying to re-compress them. FileOptions::default().compression_method(CompressionMethod::Stored) diff --git a/workspace-hack/Cargo.toml b/workspace-hack/Cargo.toml index 24ae59bcc7..1ff41b9eb2 100644 --- a/workspace-hack/Cargo.toml +++ b/workspace-hack/Cargo.toml @@ -131,6 +131,7 @@ uuid = { version = "1.10.0", features = ["serde", "v4"] } x509-cert = { version = "0.2.5" } zerocopy = { version = "0.7.35", features = ["derive", "simd"] } zeroize = { version = "1.8.1", features = ["std", "zeroize_derive"] } +zip = { version = "0.6.6", default-features = false, features = ["bzip2", "deflate"] } [build-dependencies] ahash = { version = "0.8.11" } @@ -250,6 +251,7 @@ uuid = { version = "1.10.0", features = ["serde", "v4"] } x509-cert = { version = "0.2.5" } zerocopy = { version = "0.7.35", features = ["derive", "simd"] } zeroize = { version = "1.8.1", features = ["std", "zeroize_derive"] } +zip = { version = "0.6.6", default-features = false, features = ["bzip2", "deflate"] } [target.x86_64-unknown-linux-gnu.dependencies] cookie = { version = "0.18.1", default-features = false, features = ["percent-encode"] } From edd44f541b78007c6dde6129bcf6812dba66ab0b Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Thu, 31 Oct 2024 13:00:45 -0700 Subject: [PATCH 2/3] downgrade --- Cargo.lock | 6 +++--- Cargo.toml | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3ad16afe29..19b55f9b1f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11882,7 +11882,7 @@ dependencies = [ "toml 0.8.19", "tough", "url", - "zip 2.2.0", + "zip 2.1.2", ] [[package]] @@ -13221,9 +13221,9 @@ dependencies = [ [[package]] name = "zip" -version = "2.2.0" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc5e4288ea4057ae23afc69a4472434a87a2495cafce6632fd1c4ec9f5cf3494" +checksum = "098d5d7737fb0b70814faa73c17df84f047d38dd31d13bbf2ec3fb354b5abf45" dependencies = [ "arbitrary", "bzip2", diff --git a/Cargo.toml b/Cargo.toml index 38186b5544..a76e885f43 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -632,7 +632,8 @@ wicket-common = { path = "wicket-common" } wicketd-api = { path = "wicketd-api" } wicketd-client = { path = "clients/wicketd-client" } zeroize = { version = "1.8.1", features = ["zeroize_derive", "std"] } -zip = { version = "2.2.0", default-features = false, features = ["deflate","bzip2"] } +# NOTE: Avoid upgrading zip until https://github.com/zip-rs/zip2/issues/231 is resolved +zip = { version = "=2.1.2", default-features = false, features = ["deflate","bzip2"] } zone = { version = "0.3", default-features = false, features = ["async"] } # newtype-uuid is set to default-features = false because we don't want to From 52c2eb77952cbc71578d657b45039a83ab8e4860 Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Thu, 31 Oct 2024 13:13:30 -0700 Subject: [PATCH 3/3] 2.1.3 --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 19b55f9b1f..23efca6d02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11882,7 +11882,7 @@ dependencies = [ "toml 0.8.19", "tough", "url", - "zip 2.1.2", + "zip 2.1.3", ] [[package]] @@ -13221,9 +13221,9 @@ dependencies = [ [[package]] name = "zip" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "098d5d7737fb0b70814faa73c17df84f047d38dd31d13bbf2ec3fb354b5abf45" +checksum = "775a2b471036342aa69bc5a602bc889cb0a06cda00477d0c69566757d5553d39" dependencies = [ "arbitrary", "bzip2", diff --git a/Cargo.toml b/Cargo.toml index a76e885f43..23404a9849 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -633,7 +633,7 @@ wicketd-api = { path = "wicketd-api" } wicketd-client = { path = "clients/wicketd-client" } zeroize = { version = "1.8.1", features = ["zeroize_derive", "std"] } # NOTE: Avoid upgrading zip until https://github.com/zip-rs/zip2/issues/231 is resolved -zip = { version = "=2.1.2", default-features = false, features = ["deflate","bzip2"] } +zip = { version = "=2.1.3", default-features = false, features = ["deflate","bzip2"] } zone = { version = "0.3", default-features = false, features = ["async"] } # newtype-uuid is set to default-features = false because we don't want to