From nobody Wed Feb 5 16:45:38 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eurecom.fr; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=eurecom.fr ARC-Seal: i=1; a=rsa-sha256; t=1734192901; cv=none; d=zohomail.com; s=zohoarc; b=LAft+iz4v9V0BAvv/deQA0t+T3D9Dv2Ac/vxHVtVnmihLUrkG05a0SDxJIdWX8Apkpn2zhDi1lDiuZnspSJwf1zFI3lBiqQJjwpxHUgIJC2Ug2KAEEmoRbpFvTmE3WestHaXMRmZjEyz/df2DlswWCbD798BzLgHxiMdoG1xWCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1734192901; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4Q0ZfInp3kp+TzNrB3PlO3yu8D8fJPHsIdGSOSp+3Xo=; b=i/m/pOtjsMb4F7FFIkzSzGEKGuRxcqDCa85OTEbBIZGfykrPxQZkioiCcjBzl6CxRZXLe2ND3gQeEGkITf3pHyUMlAbtDBOxxZm+Sy6diH9TCwaOZ1u4xPrBhwTUwDCIn59uq3GLR0Seu+tpnOKB6vGSUxYLqZaFk6kEUw3aYD8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@eurecom.fr; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1734192901806515.8529911149744; Sat, 14 Dec 2024 08:15:01 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.857387.1269697 (Exim 4.92) (envelope-from ) id 1tMUn0-0006Aa-Iv; Sat, 14 Dec 2024 16:14:46 +0000 Received: by outflank-mailman (output) from mailman id 857387.1269697; Sat, 14 Dec 2024 16:14:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tMUn0-0006AT-F6; Sat, 14 Dec 2024 16:14:46 +0000 Received: by outflank-mailman (input) for mailman id 857387; Sat, 14 Dec 2024 16:14:45 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tMUmz-0006AH-RT for xen-devel@lists.xenproject.org; Sat, 14 Dec 2024 16:14:45 +0000 Received: from smtp.eurecom.fr (smtp.eurecom.fr [193.55.113.210]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 876dfd29-ba36-11ef-99a3-01e77a169b0f; Sat, 14 Dec 2024 17:14:43 +0100 (CET) Received: from waha.eurecom.fr (HELO smtps.eurecom.fr) ([10.3.2.236]) by drago1i.eurecom.fr with ESMTP; 14 Dec 2024 17:14:43 +0100 Received: from localhost.localdomain (88-183-119-157.subs.proxad.net [88.183.119.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtps.eurecom.fr (Postfix) with ESMTPSA id 272AA2C55; Sat, 14 Dec 2024 17:14:43 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 876dfd29-ba36-11ef-99a3-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=eurecom.fr; i=@eurecom.fr; q=dns/txt; s=default; t=1734192884; x=1765728884; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OPZcqoYnos1qDgrzyTEHlZczqYru4m8U1RTFC0EoMks=; b=CTcYYxe43Yq4CkNFgi5O+AAzyTFLZdjvZ1jZkElaChMU4fGIwLxkrJq1 Xr0n7UWjTqjoT1aw4gG6bK2hEBDXewO309V6m+8Z5zyqVh+cIwiZrFOxp ne0uql/n1HN5KinjUbhoXgT4jdOakAFbUFsbJPkTvn4sgADtMLTNabLMi A=; X-CSE-ConnectionGUID: K0GWcpOhRWaD/5qqjLPwjg== X-CSE-MsgGUID: mR7jXJG6TGuWOnWQFTyL9g== X-IronPort-AV: E=Sophos;i="6.12,234,1728943200"; d="scan'208";a="28182307" From: Ariel Otilibili To: xen-devel@lists.xenproject.org Cc: Jan Beulich , nthony PERARD , Ariel Otilibili , Luca Fancellu Subject: [PATCH 1/1] tools, xen/scripts: clear out Python syntax warnings Date: Sat, 14 Dec 2024 17:09:51 +0100 Message-ID: <20241214161350.70515-3-Ariel.Otilibili-Anieli@eurecom.fr> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241214161350.70515-1-Ariel.Otilibili-Anieli@eurecom.fr> References: <20241214161350.70515-1-Ariel.Otilibili-Anieli@eurecom.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @eurecom.fr) X-ZM-MESSAGEID: 1734192903963116600 Content-Type: text/plain; charset="utf-8" * since 3.12 invalid escape sequences generate SyntaxWarning * in the future, these invalid sequences will generate SyntaxError * therefore changed syntax to raw string notation. Link: https://docs.python.org/3/whatsnew/3.12.html#other-language-changes Fixes: e45e8f69047 ("bitkeeper revision 1.803 (4056f51d2UjBnn9uwzC9Vu3LspnU= Cg)") Fixes: d8f3a67bf98 ("pygrub: further improve grub2 support") Fixes: dd03048708a ("xen/pygrub: grub2/grub.cfg from RHEL 7 has new command= s in menuentry") Fixes: d1b93ea2615 ("tools/pygrub: Make pygrub understand default entry in = string format") Fixes: 622e368758b ("Add ZFS libfsimage support patch") Fixes: 02b26c02c7c ("xen/scripts: add cppcheck tool to the xen-analysis.py = script") Fixes: 56c0063f4e7 ("xen/misra: xen-analysis.py: Improve the cppcheck versi= on check") Cc: Anthony PERARD Cc: Luca Fancellu Signed-off-by: Ariel Otilibili Acked-by: Ariel Otilibili-Anieli --- tools/misc/xensymoops | 4 ++-- tools/pygrub/src/GrubConf.py | 4 ++-- tools/pygrub/src/pygrub | 6 +++--- xen/scripts/xen_analysis/cppcheck_analysis.py | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/misc/xensymoops b/tools/misc/xensymoops index 835d187e90..bec75cae93 100755 --- a/tools/misc/xensymoops +++ b/tools/misc/xensymoops @@ -17,7 +17,7 @@ def read_oops(): stack_addrs is a dictionary mapping potential code addresses in the st= ack to their order in the stack trace. """ - stackaddr_ptn =3D "\[([a-z,0-9]*)\]" + stackaddr_ptn =3D r"\[([a-z,0-9]*)\]" stackaddr_re =3D re.compile(stackaddr_ptn) =20 eip_ptn =3D ".*EIP:.*<([a-z,0-9]*)>.*" @@ -67,7 +67,7 @@ addr_ptn =3D "([a-z,0-9]*):" addr_re =3D re.compile(addr_ptn) =20 # regexp to match the start of functions in the objdump -func_ptn =3D "(.*<[\S]*>):" +func_ptn =3D r"(.*<[\S]*>):" func_re =3D re.compile(func_ptn) =20 func =3D "" # holds the name of the current function being sc= anned diff --git a/tools/pygrub/src/GrubConf.py b/tools/pygrub/src/GrubConf.py index 580c9628ca..7cd2bc9aeb 100644 --- a/tools/pygrub/src/GrubConf.py +++ b/tools/pygrub/src/GrubConf.py @@ -320,7 +320,7 @@ class GrubConfigFile(_GrubConfigFile): def grub2_handle_set(arg): (com,arg) =3D grub_split(arg,2) com=3D"set:" + com - m =3D re.match("([\"\'])(.*)\\1", arg) + m =3D re.match(r"([\"\'])(.*)\\1", arg) if m is not None: arg=3Dm.group(2) return (com,arg) @@ -402,7 +402,7 @@ class Grub2ConfigFile(_GrubConfigFile): continue =20 # new image - title_match =3D re.match('^menuentry ["\'](.*?)["\'] (.*){', l) + title_match =3D re.match(r'^menuentry ["\'](.*?)["\'] (.*){', = l) if title_match: if img is not None: raise RuntimeError("syntax error: cannot nest menuentr= y (%d %s)" % (len(img),img)) diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub index 9d51f96070..58b088d285 100755 --- a/tools/pygrub/src/pygrub +++ b/tools/pygrub/src/pygrub @@ -614,7 +614,7 @@ class Grub: title =3D self.cf.default while 1: try: - title =3D re.search('(\S)>(\S.+$)',title).group(2) + title =3D re.search(r'(\S)>(\S.+$)',title).group(2) except AttributeError: break =20 @@ -1039,7 +1039,7 @@ if __name__ =3D=3D "__main__": =20 # if boot filesystem is set then pass to fsimage.open bootfsargs =3D '"%s"' % incfg["args"] - bootfsgroup =3D re.findall('zfs-bootfs=3D(.*?)[\s\,\"]', bootfsargs) + bootfsgroup =3D re.findall(r'zfs-bootfs=3D(.*?)[\s\,\"]', bootfsargs) if bootfsgroup: bootfsoptions =3D bootfsgroup[0] else: @@ -1104,7 +1104,7 @@ if __name__ =3D=3D "__main__": if chosencfg["args"]: zfsinfo =3D xenfsimage.getbootstring(fs) if zfsinfo is not None: - e =3D re.compile("zfs-bootfs=3D[\w\-\.\:@/]+" ) + e =3D re.compile(r"zfs-bootfs=3D[\w\-\.\:@/]+" ) (chosencfg["args"],count) =3D e.subn(zfsinfo, chosencfg["args"= ]) if count =3D=3D 0: chosencfg["args"] +=3D " -B %s" % zfsinfo diff --git a/xen/scripts/xen_analysis/cppcheck_analysis.py b/xen/scripts/xe= n_analysis/cppcheck_analysis.py index 850335c998..ce7bda91b6 100644 --- a/xen/scripts/xen_analysis/cppcheck_analysis.py +++ b/xen/scripts/xen_analysis/cppcheck_analysis.py @@ -93,7 +93,7 @@ def __generate_suppression_list(out_file): # start of a comment '/*' comment_line_starts =3D re.match('^[ \t]*/\*.*$', = line) # Matches a line with text and the end of a commen= t '*/' - comment_line_stops =3D re.match('^.*\*/$', line) + comment_line_stops =3D re.match(r'^.*\*/$', line) if (not comment_section) and comment_line_starts: comment_section =3D True if (len(line.strip()) !=3D 0) and (not comment_sec= tion): @@ -157,7 +157,7 @@ def generate_cppcheck_deps(): "Error occured retrieving cppcheck version:\n{}\n\n{}" ) =20 - version_regex =3D re.search('^Cppcheck (\d+)\.(\d+)(?:\.\d+)?$', + version_regex =3D re.search(r'^Cppcheck (\d+)\.(\d+)(?:\.\d+)?$', invoke_cppcheck, flags=3Dre.M) # Currently, only cppcheck version >=3D 2.7 is supported, but version = 2.8 is # known to be broken, please refer to docs/misra/cppcheck.txt --=20 2.47.1