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 8716D1FF15C for ; Wed, 18 Sep 2024 15:01:02 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4535935565; Wed, 18 Sep 2024 15:01:10 +0200 (CEST) From: Daniel Kral To: pbs-devel@lists.proxmox.com Date: Wed, 18 Sep 2024 15:01:00 +0200 Message-Id: <20240918130100.193090-2-d.kral@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20240918130100.193090-1-d.kral@proxmox.com> References: <20240918130100.193090-1-d.kral@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.002 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com, pbs2to3.rs] Subject: [pbs-devel] [PATCH proxmox-backup v4 2/2] fix #5600: pbs2to3: allow arbitrary newer '-pve' kernels after upgrade X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Fixes a bug where `pbs2to3` shows an incorrect warning about an unexpected running kernel version, where newer kernel versions than 6.5 were marked as unexpected (e.g. "8.6.12-1-pve"). This commit allows arbitrary newer kernel versions that are suffixed with '-pve' from kernel version 6.2 onward. This is the same behavior as in other upgrade helpers like `pve7to8` [1] and `pmg7to8` [2]. [1] https://git.proxmox.com/?p=pve-manager.git;a=commit;h=fb59038a8b110b0b0b438ec035fd41dd9d591232 [2] https://git.proxmox.com/?p=pmg-api.git;a=commit;h=9d67a9af218b73027822c9c4665b88e6662e7ef7 Signed-off-by: Daniel Kral --- I've used a single regex pattern instead of the two sequential regex pattern matches in the linked commits from pve-manager and pmg-api, because I thought it would be a little more readable when only compiling the regex patterns at one location here. Changes to v1/v2/v3: - Split up kernel version regex to make it a little more readable - Include arbitrary newer versions from 6.2 onward ending with '-pve' src/bin/pbs2to3.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/bin/pbs2to3.rs b/src/bin/pbs2to3.rs index d90e62ce..0d6a4b10 100644 --- a/src/bin/pbs2to3.rs +++ b/src/bin/pbs2to3.rs @@ -2,6 +2,7 @@ use std::io::Write; use std::path::Path; use anyhow::{format_err, Error}; +use const_format::concatcp; use regex::Regex; use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor}; @@ -124,8 +125,11 @@ impl Checker { } fn is_kernel_version_compatible(&self, running_version: &str) -> bool { + const MINIMUM_RE: &str = r"6\.(?:2\.(?:[2-9]\d+|1[6-8]|1\d\d+)|5)[^~]*"; + const ARBITRARY_RE: &str = r"(?:[6-9]|\d{2,})\.(?:[2-9]|\d{2,})[^~]*-pve"; + let re = if self.upgraded { - r"^6\.(?:2\.(?:[2-9]\d+|1[6-8]|1\d\d+)|5)[^~]*$" + concatcp!(r"^(?:", MINIMUM_RE, r"|", ARBITRARY_RE, r")$") } else { r"^(?:5\.(?:13|15)|6\.2)" }; @@ -662,7 +666,7 @@ mod tests { #[test] fn test_is_proxmox_kernel_version_compatible() { - let expected_versions = &["6.2.16-20-pve", "6.5.13-6-pve"]; + let expected_versions = &["6.2.16-20-pve", "6.5.13-6-pve", "6.8.12-1-pve"]; let unexpected_versions = &["5.13.19-6-pve", "6.1.15-1-pve"]; test_is_kernel_version_compatible(expected_versions, unexpected_versions, true); -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel