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 5750C1FF0AF for ; Thu, 22 Oct 2026 13:20:57 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 78557215D4; Thu, 22 Oct 2026 13:20:53 +0200 (CEST) Date: Thu, 22 Oct 2026 13:20:47 +0200 From: Wolfgang Bumiller To: Filip Schauer Subject: Re: [PATCH proxmox] oci: drop unnecessary Result from layer decode_fn Message-ID: <3xgxescry5erkm5xt5m6pt3oleljb5ifxrwfabsx6wwonnh46a@o6bidvabgyrr> References: <20261013083039.27681-1-f.schauer@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261013083039.27681-1-f.schauer@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1792668047505 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.445 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: JYHYPN4DQAHEMTBTJDUZ23CWIODRBFTK X-Message-ID-Hash: JYHYPN4DQAHEMTBTJDUZ23CWIODRBFTK X-MailFrom: w.bumiller@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 CC: pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Tue, Oct 13, 2026 at 10:30:37AM +0200, Filip Schauer wrote: > zstd::Decoder::new cannot fail (see gyscos/zstd-rs#281), so simplify I don't want to rely on something happening in a dependency's wrapped library like that. Let's just wait for `zstd` to drop the `Result` *or* at the very least make the error case `Infallible`/`!`. > 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