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 9925B1FF389 for ; Wed, 5 Jun 2024 10:29:30 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1D6021E33A; Wed, 5 Jun 2024 10:30:00 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Wed, 5 Jun 2024 10:29:24 +0200 Message-Id: <20240605082924.60327-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.059 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 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [mod.rs] Subject: [pve-devel] [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" 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