From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 0931C1FF396 for ; Thu, 6 Jun 2024 11:08:17 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9AF2EA5ED; Thu, 6 Jun 2024 11:08:46 +0200 (CEST) Date: Thu, 06 Jun 2024 11:08:10 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20240605082924.60327-1-f.ebner@proxmox.com> In-Reply-To: <20240605082924.60327-1-f.ebner@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1717664883.doyowm88dy.astroid@yuna.none> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.058 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 T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] applied: [PATCH proxmox] fix #5513: apt: do not assume that sources.list file exists 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" thanks! On June 5, 2024 10:29 am, Fiona Ebner wrote: > Some users might want to switch to using only the newer .sources files > already, which Debian is going to switch to in the long run. > > Signed-off-by: Fiona Ebner > --- > proxmox-apt/src/repositories/mod.rs | 21 +++++++++++++++------ > 1 file changed, 15 insertions(+), 6 deletions(-) > > diff --git a/proxmox-apt/src/repositories/mod.rs b/proxmox-apt/src/repositories/mod.rs > index 7bfe9cae..26e4192c 100644 > --- a/proxmox-apt/src/repositories/mod.rs > +++ b/proxmox-apt/src/repositories/mod.rs > @@ -146,12 +146,21 @@ pub fn repositories() -> Result { > > let sources_list_d_path = PathBuf::from(APT_SOURCES_LIST_DIRECTORY); > > - match APTRepositoryFile::new(sources_list_path) { > - Ok(Some(mut file)) => match file.parse() { > - Ok(()) => files.push(file), > - Err(err) => errors.push(err), > - }, > - _ => bail!("internal error with '{}'", APT_SOURCES_LIST_FILENAME), > + if sources_list_path.exists() { > + if sources_list_path.is_file() { > + match APTRepositoryFile::new(sources_list_path) { > + Ok(Some(mut file)) => match file.parse() { > + Ok(()) => files.push(file), > + Err(err) => errors.push(err), > + }, > + _ => bail!("internal error with '{}'", APT_SOURCES_LIST_FILENAME), > + } > + } else { > + errors.push(APTRepositoryFileError { > + path: APT_SOURCES_LIST_FILENAME.to_string(), > + error: "not a regular file!".to_string(), > + }); > + } > } > > if !sources_list_d_path.exists() { > -- > 2.39.2 > > > > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > > _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel