From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 455DC1FF179 for ; Wed, 29 Oct 2025 11:54:38 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 49CB06D6A; Wed, 29 Oct 2025 11:55:11 +0100 (CET) Mime-Version: 1.0 Date: Wed, 29 Oct 2025 11:55:08 +0100 Message-Id: To: "Nicolas Frey" X-Mailer: aerc 0.20.0 References: <20251023103953.305810-1-n.frey@proxmox.com> <20251023103953.305810-5-n.frey@proxmox.com> In-Reply-To: <20251023103953.305810-5-n.frey@proxmox.com> From: "Shannon Sterz" X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1761735296084 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.061 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH proxmox v5 4/4] apt: check for local POM InRelease as fallback X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Cc: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" On Thu Oct 23, 2025 at 12:39 PM CEST, Nicolas Frey wrote: > Add local file fallback in case that the URI starts with `file://`, > which is useful if a POM repo is stored on a medium. This improves > UX by not necessarily needing to apt update to see immediate feedback > in the Repositories UI of pve/pbs. > > If the medium is not present, the signature verification will simply > fail. > > Signed-off-by: Nicolas Frey > --- > proxmox-apt/src/repositories/repository.rs | 21 +++++++++++++++------ > 1 file changed, 15 insertions(+), 6 deletions(-) > > diff --git a/proxmox-apt/src/repositories/repository.rs b/proxmox-apt/src/repositories/repository.rs > index 1b3f010e..b8b2ecc4 100644 > --- a/proxmox-apt/src/repositories/repository.rs > +++ b/proxmox-apt/src/repositories/repository.rs > @@ -396,12 +396,7 @@ fn write_stanza(repo: &APTRepository, w: &mut dyn Write) -> Result<(), Error> { > /// Reads file contents of cached/local POM InRelease file from uri > /// and key to verify pgp signature > fn is_signed_by_key(uri: &str, suite: &str, key_path: &str) -> bool { > - let data = match std::fs::read(&release_filename( > - Path::new("/var/lib/apt/lists"), > - uri, > - suite, > - false, > - )) { > + let data = match read_inrelease(uri, suite) { > Ok(d) => d, > Err(err) => { > log::warn!("could not read InRelease file: {err}"); > @@ -425,6 +420,20 @@ fn is_signed_by_key(uri: &str, suite: &str, key_path: &str) -> bool { > true > } > > +/// Reads cached/local POM InRelease file > +fn read_inrelease(uri: &str, suite: &str) -> Result, Error> { > + let path = release_filename(Path::new("/var/lib/apt/lists"), uri, suite, false); > + > + if path.exists() { > + std::fs::read(&path).map_err(Into::into) > + } else if let Some(local_path) = uri.strip_prefix("file://") { > + let inrelease_path = format!("{}/dists/{}/InRelease", local_path, suite); > + std::fs::read(&inrelease_path).map_err(Into::into) > + } else { > + bail!("Unsupported URI scheme: {}", uri); > + } the variables in the format! and bail! macros above should be in-lined :) > +} > + > #[test] > fn test_uri_to_filename() { > let filename = uri_to_filename("https://some_host/some/path"); _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel