From nobody Wed May 15 19:18:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+112986+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+112986+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1703782075; cv=none; d=zohomail.com; s=zohoarc; b=mXisFUSLuDR7Vqt4UMRJHcPY6vAXsF1dc7u9nqfrBwO8ueag2XcdYkSYXKvRLoQho8VAz3NfskL6VQRrMfxPLjlKV0b1fHHr7uf0smJCHxJ+l9QU+VBlO+hRH8OFIS5fk6R+Vl+hUf2x59yhpInHfI6eS0xxLCV01r1ArK7Eh8M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1703782075; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=mWv4GDONX1zqrqItg0l/QixpxirzAe4ixC5rlc+IT+k=; b=QaKkQzcDHItWjNjsEWzUEdP9kN6c1a8MHBHiwSUS8myDyX8awriq4n3i8rKNtZ7GDC1PM4oJq5t37XSMnUX+meh+L/g5Z21HxsRVIToDjqtD63yfwx/DcDQn4UDo12mw+HibKuW6paCfXSyTY/0Y8yeBYjaCzQyDT12czfD6Xnc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+112986+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1703782075590394.5544341088787; Thu, 28 Dec 2023 08:47:55 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=frwdlGveBogXsAgBYj24fGRL5qytwN2jnEx2gq/YqCA=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1703782075; v=1; b=kqBjn2iBrpAQWmd5X0QNehHAd5PQgpX4fIG6Ft9u/P1J4ec4l81bt8/Ll5uVGOOoI/Dkfkd9 XbGNY8dKIiq7+aZDsjb6JHkZUFF63KIph8KQ567IV2UTEn6RvTrUL8P59z0XU04oza7d/YwSPXv MiVrWrIq38JryaLqxvXUrcnY= X-Received: by 127.0.0.2 with SMTP id dK64YY1788612xIqZILiHI0O; Thu, 28 Dec 2023 08:47:55 -0800 X-Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mx.groups.io with SMTP id smtpd.web11.126680.1703782074768698882 for ; Thu, 28 Dec 2023 08:47:54 -0800 X-Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1d45f182fa2so21817915ad.3 for ; Thu, 28 Dec 2023 08:47:54 -0800 (PST) X-Gm-Message-State: coBRSTct0aNbBbPckWdQlCC6x1787277AA= X-Google-Smtp-Source: AGHT+IGNiC19M4YDwCgn8i/iO5DmYMUxFouwmWie17CR++B7Or8z58SCfdPxb9tCbZTrr05KlFVlLg== X-Received: by 2002:a17:902:6f02:b0:1cf:cf0f:cc3a with SMTP id w2-20020a1709026f0200b001cfcf0fcc3amr9542693plk.17.1703782073733; Thu, 28 Dec 2023 08:47:53 -0800 (PST) X-Received: from localhost.localdomain (c-174-164-102-13.hsd1.wa.comcast.net. [174.164.102.13]) by smtp.gmail.com with ESMTPSA id x19-20020a170902821300b001d4816958c2sm3479241pln.166.2023.12.28.08.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 08:47:52 -0800 (PST) From: "Joey Vagedes via groups.io" To: devel@edk2.groups.io Cc: Rebecca Cran , Liming Gao , Bob Feng , Yuwei Chen Subject: [edk2-devel] [PATCH v1 1/1] BaseTools: Fix raw strings containing valid escape characters Date: Thu, 28 Dec 2023 08:47:39 -0800 Message-ID: <20231228164739.1042-2-joey.vagedes@gmail.com> In-Reply-To: <20231228164739.1042-1-joey.vagedes@gmail.com> References: <20231228164739.1042-1-joey.vagedes@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,joeyvagedes@microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1703782076035100001 Content-Type: text/plain; charset="utf-8" Fixes raw regex strings that contain valid (and purposeful) escape characters as they are being treated as individual characters rather than the single escaped character they represent (i.e. '\t' is being treated as a '\' and a 't' rather than a single tab character). Signed-off-by: Joey Vagedes Cc: Rebecca Cran Cc: Liming Gao Cc: Bob Feng Cc: Yuwei Chen Reviewed-by: Yuwei Chen --- BaseTools/Source/Python/AutoGen/GenMake.py | 2 +- BaseTools/Source/Python/Common/Misc.py | 2 +- BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/= Python/AutoGen/GenMake.py index c416fe172fe5..fbd35d498923 100755 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -28,7 +28,7 @@ from Common.DataType import TAB_COMPILER_MSFT gIncludePattern =3D re.compile(r"^[ \t]*[#%]?[ \t]*include(?:[ \t]*(?:\\(?= :\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)= ?)", re.MULTILINE | re.UNICODE | re.IGNORECASE) =20 ## Regular expression for matching macro used in header file inclusion -gMacroPattern =3D re.compile(r"([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICO= DE) +gMacroPattern =3D re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\\((.+)\\)", re.UNIC= ODE) =20 gIsFileMap =3D {} =20 diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index f87d9dbdba39..34bfc90abd94 100755 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1926,4 +1926,4 @@ def CopyDict(ori_dict): # Remove the c/c++ comments: // and /* */ # def RemoveCComments(ctext): - return re.sub(r'//.*?\n|/\*.*?\*/', '\n', ctext, flags=3Dre.S) + return re.sub('//.*?\n|/\\*.*?\\*/', '\n', ctext, flags=3Dre.S) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index 817cdbe5f19c..4768099343e5 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -2840,7 +2840,7 @@ class DscBuildData(PlatformBuildClassObject): # start generating makefile MakeApp =3D PcdMakefileHeader if sys.platform =3D=3D "win32": - MakeApp =3D MakeApp + r'APPFILE =3D %s\%s.exe\n' % (self.Outpu= tPath, PcdValueInitName) + r'APPNAME =3D %s\n' % (PcdValueInitName) + r'OBJ= ECTS =3D %s\%s.obj %s.obj\n' % (self.OutputPath, PcdValueInitName, os.path.= join(self.OutputPath, PcdValueCommonName)) + 'INC =3D ' + MakeApp =3D MakeApp + 'APPFILE =3D %s\\%s.exe\n' % (self.Outpu= tPath, PcdValueInitName) + 'APPNAME =3D %s\n' % (PcdValueInitName) + 'OBJEC= TS =3D %s\\%s.obj %s.obj\n' % (self.OutputPath, PcdValueInitName, os.path.j= oin(self.OutputPath, PcdValueCommonName)) + 'INC =3D ' else: MakeApp =3D MakeApp + PcdGccMakefile MakeApp =3D MakeApp + 'APPFILE =3D %s/%s\n' % (self.OutputPath= , PcdValueInitName) + 'APPNAME =3D %s\n' % (PcdValueInitName) + 'OBJECTS = =3D %s/%s.o %s.o\n' % (self.OutputPath, PcdValueInitName, os.path.join(self= .OutputPath, PcdValueCommonName)) + \ @@ -2950,7 +2950,7 @@ class DscBuildData(PlatformBuildClassObject): MakeApp +=3D "$(OBJECTS) : %s\n" % include_file if sys.platform =3D=3D "win32": PcdValueCommonPath =3D os.path.normpath(mws.join(GlobalData.gG= lobalDefines["EDK_TOOLS_PATH"], "Source\C\Common\PcdValueCommon.c")) - MakeApp =3D MakeApp + r'%s\PcdValueCommon.c : %s\n' % (self.Ou= tputPath, PcdValueCommonPath) + MakeApp =3D MakeApp + '%s\\PcdValueCommon.c : %s\n' % (self.Ou= tputPath, PcdValueCommonPath) MakeApp =3D MakeApp + '\tcopy /y %s $@\n' % (PcdValueCommonPat= h) else: PcdValueCommonPath =3D os.path.normpath(mws.join(GlobalData.gG= lobalDefines["EDK_TOOLS_PATH"], "Source/C/Common/PcdValueCommon.c")) --=20 2.43.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112986): https://edk2.groups.io/g/devel/message/112986 Mute This Topic: https://groups.io/mt/103403582/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-