From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 5BF011FF0AE for ; Tue, 13 Oct 2026 10:30:51 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 3BD99212CF; Tue, 13 Oct 2026 10:30:50 +0200 (CEST) From: Filip Schauer To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox] oci: drop unnecessary Result from layer decode_fn Date: Tue, 13 Oct 2026 10:30:37 +0200 Message-ID: <20261013083039.27681-1-f.schauer@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1791880244336 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.437 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: X3KCXPIFY7AW7VJXO3H7CBYPYPI3SLXM X-Message-ID-Hash: X3KCXPIFY7AW7VJXO3H7CBYPYPI3SLXM X-MailFrom: f.schauer@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: zstd::Decoder::new cannot fail (see gyscos/zstd-rs#281), so simplify DecodeFn to return Box directly. Signed-off-by: Filip Schauer --- proxmox-oci/src/lib.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/proxmox-oci/src/lib.rs b/proxmox-oci/src/lib.rs index b274e46a..3b6dbeb0 100644 --- a/proxmox-oci/src/lib.rs +++ b/proxmox-oci/src/lib.rs @@ -201,16 +201,17 @@ fn extract_image_rootfs>( .open_blob(layer_descriptor.digest()) .ok_or(ExtractError::MissingLayerFile(layer_digest))?; - type DecodeFn = Box Fn(&'a mut T) -> io::Result>>; + type DecodeFn = Box Fn(&'a mut T) -> Box>; let decode_fn: DecodeFn> = match layer_descriptor.media_type() { MediaType::ImageLayer | MediaType::ImageLayerNonDistributable => { - Box::new(|file| Ok(Box::new(file))) + Box::new(|file| Box::new(file)) } MediaType::ImageLayerGzip | MediaType::ImageLayerNonDistributableGzip => { - Box::new(|file| Ok(Box::new(GzDecoder::new(file)))) + Box::new(|file| Box::new(GzDecoder::new(file))) } MediaType::ImageLayerZstd | MediaType::ImageLayerNonDistributableZstd => { - Box::new(|file| Ok(Box::new(zstd::Decoder::new(file)?))) + // https://github.com/gyscos/zstd-rs/issues/281 + Box::new(|file| Box::new(zstd::Decoder::new(file).expect("infallible"))) } // Error on any other non-ImageLayer related media types. // Match explicitly to avoid missing new image layer types when oci-spec updates. @@ -226,9 +227,9 @@ fn extract_image_rootfs>( } }; - apply_whiteouts(&mut decode_fn(&mut layer_file)?, &target_path)?; + apply_whiteouts(&mut decode_fn(&mut layer_file), &target_path)?; layer_file.seek(SeekFrom::Start(0))?; - extract_archive(&mut decode_fn(&mut layer_file)?, &target_path)?; + extract_archive(&mut decode_fn(&mut layer_file), &target_path)?; oci_tar_image = layer_file.into_oci_tar_image(); } -- 2.47.3