From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id BF5C2740034 for ; Fri, 22 Mar 2024 19:19:33 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Y2pFEndgLiW8Gy6YHCGgpR7mUGBrHD+fli8ZzA+P1Tk=; 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:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1711135172; v=1; b=s9UiBtcPQZiBAFZG3zjbyJohbbH7qF1m6TInhGhHbCQjv5E58ii0iT1CX9LIuUdDaB2Utcfz oG04WlNgmkclCloQ7lQsGQmBZoLNfKjoKudYNVeqiD8TsPER2HqKHGGwh798NvyHrCSh1CvO9jG FSqq/dyNeUKSbM2laqoE1S6YGk0+z4+XuAxpJf/ZsYeI861XetLkiFtMeFlSx5z3lLEzub1iDU9 pXRDIONoOX5H4lDHF8vDE+KQklpIMJh7GkUCtgUVYbVqwlE6NKslwR5PawJTvqAP91cf6vWnE5t BhBoDhTudYttJZVCQdTKFDXUGTtIw6qrdN+KrmaZCGfjQ== X-Received: by 127.0.0.2 with SMTP id eTugYY7687511xAXzZ96Qte1; Fri, 22 Mar 2024 12:19:32 -0700 X-Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by mx.groups.io with SMTP id smtpd.web11.4128.1711135171528668888 for ; Fri, 22 Mar 2024 12:19:31 -0700 X-Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1dddbeac9f9so15871425ad.3 for ; Fri, 22 Mar 2024 12:19:31 -0700 (PDT) X-Gm-Message-State: 02znl5hHo7ql1hnMmeX7bFs6x7686176AA= X-Google-Smtp-Source: AGHT+IEWiT+YuYCbfustPtmdMiBM4mjc7GmYnx50lpoKReqXUAya7rgn26cAAqZhPlEcy/uveH3EWw== X-Received: by 2002:a17:902:9a91:b0:1dd:b6c0:1363 with SMTP id w17-20020a1709029a9100b001ddb6c01363mr641546plp.69.1711135170802; Fri, 22 Mar 2024 12:19:30 -0700 (PDT) X-Received: from localhost.localdomain ([4.155.48.118]) by smtp.gmail.com with ESMTPSA id g7-20020a170902f74700b001dd2bacf30asm81103plw.162.2024.03.22.12.19.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 12:19:30 -0700 (PDT) From: "Taylor Beebe" To: devel@edk2.groups.io Cc: Rebecca Cran , Liming Gao , Bob Feng , Yuwei Chen Subject: [edk2-devel] [PATCH v2 2/2] BaseTools: Use Stronger Matching for NULL Linked Libraries Date: Fri, 22 Mar 2024 12:19:15 -0700 Message-Id: <20240322191915.184-3-taylor.d.beebe@gmail.com> In-Reply-To: <20240322191915.184-1-taylor.d.beebe@gmail.com> References: <20240322191915.184-1-taylor.d.beebe@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 Resent-Date: Fri, 22 Mar 2024 12:19:31 -0700 Reply-To: devel@edk2.groups.io,taylor.d.beebe@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=s9UiBtcP; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io To prevent the possibility that a library with a name like NULLTestLib is interpreted as a NULL linked library, use more explicit pattern matching to ensure that the library name follows the pattern NULL%d. Signed-off-by: Taylor Beebe Cc: Rebecca Cran Cc: Liming Gao Cc: Bob Feng Cc: Yuwei Chen --- BaseTools/Source/Python/GenFds/FfsInfStatement.py | 4 ++-- BaseTools/Source/Python/Workspace/WorkspaceCommon.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py index 6550d939d4..ec9713484e 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -93,7 +93,7 @@ class FfsInfStatement(FfsInfStatementClassObject): if ModuleType != SUP_MODULE_USER_DEFINED and ModuleType != SUP_MODULE_HOST_APPLICATION: for LibraryClass in PlatformDataBase.LibraryClasses.GetKeys(): - if LibraryClass.startswith("NULL") and PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]: + if LibraryClass.startswith("NULL") and LibraryClass[4:].isdigit() and PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]: self.InfModule.LibraryClasses[LibraryClass] = PlatformDataBase.LibraryClasses[LibraryClass, ModuleType] StrModule = str(self.InfModule) @@ -101,7 +101,7 @@ class FfsInfStatement(FfsInfStatementClassObject): if StrModule in PlatformDataBase.Modules: PlatformModule = PlatformDataBase.Modules[StrModule] for LibraryClass in PlatformModule.LibraryClasses: - if LibraryClass.startswith("NULL"): + if LibraryClass.startswith("NULL") and LibraryClass[4:].isdigit(): self.InfModule.LibraryClasses[LibraryClass] = PlatformModule.LibraryClasses[LibraryClass] DependencyList = [self.InfModule] diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py index 8bb6553c6f..c3b26b370a 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py @@ -102,12 +102,12 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha # if Module.ModuleType != SUP_MODULE_USER_DEFINED: for LibraryClass in Platform.LibraryClasses.GetKeys(): - if LibraryClass.startswith("NULL") and Platform.LibraryClasses[LibraryClass, Module.ModuleType]: + if LibraryClass.startswith("NULL") and LibraryClass[4:].isdigit() and Platform.LibraryClasses[LibraryClass, Module.ModuleType]: Module.LibraryClasses[LibraryClass] = Platform.LibraryClasses[LibraryClass, Module.ModuleType] # add forced library instances (specified in module overrides) for LibraryClass in Platform.Modules[str(Module)].LibraryClasses: - if LibraryClass.startswith("NULL"): + if LibraryClass.startswith("NULL") and LibraryClass[4:].isdigit(): Module.LibraryClasses[LibraryClass] = Platform.Modules[str(Module)].LibraryClasses[LibraryClass] # EdkII module @@ -123,7 +123,7 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha while len(LibraryConsumerList) > 0: M = LibraryConsumerList.pop() for LibraryClassName in M.LibraryClasses: - if LibraryClassName.startswith("NULL") and bool(M.LibraryClass): + if LibraryClassName.startswith("NULL") and LibraryClass[4:].isdigit() and bool(M.LibraryClass): continue if LibraryClassName not in LibraryInstance: # override library instance for this module @@ -141,7 +141,7 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha LibraryModule = BuildDatabase[LibraryPath, Arch, Target, Toolchain] # for those forced library instance (NULL library), add a fake library class - if LibraryClassName.startswith("NULL"): + if LibraryClassName.startswith("NULL") and LibraryClass[4:].isdigit(): LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType])) elif LibraryModule.LibraryClass is None \ or len(LibraryModule.LibraryClass) == 0 \ -- 2.40.1.vfs.0.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117063): https://edk2.groups.io/g/devel/message/117063 Mute This Topic: https://groups.io/mt/105092035/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-