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 1C8F0AC1972 for ; Tue, 9 Apr 2024 19:36:59 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=sDHIMgAz6Ao3D/mzp0bcKFyEs5Hv3jhp7yG8OqYxJfk=; 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:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1712691418; v=1; b=voOOoFdD8SHRgvX8okWzXgy8zzGUMjW4PtT8UP/9kfVBKft7fU03b7Pf9XCod3o/khJUDYUH wltEPPTVez+pHQbX8HM+9RVYNOysyquFO25tPn0x5zV3q0H3mdEikqFKsa8rEiad7jwI1HYc5Qz Z0blzbb50Nh5X275LAVPG3PjvWekTabGsS2Vku++2TMgiCIKPg6FFNstmlbeBXUKuRhYFFS6Ogq 9BRcP+XxkxZfaq1Z7/232ZscYUn8rSDy55h+xEBapH+c65TSc7373N0tAtUQvFbbeE+dykoihZM jUJA3Bx39xPg3q3ewb3lT/jchNU+rCC2n6rwTtecYIX4Q== X-Received: by 127.0.0.2 with SMTP id tbxdYY7687511xcChBTF4HMl; Tue, 09 Apr 2024 12:36:58 -0700 X-Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by mx.groups.io with SMTP id smtpd.web10.147366.1712691417231283286 for ; Tue, 09 Apr 2024 12:36:57 -0700 X-Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-6ed32341906so2077377b3a.1 for ; Tue, 09 Apr 2024 12:36:57 -0700 (PDT) X-Gm-Message-State: W9vwJJxCR8S0XMVyqfBq24osx7686176AA= X-Google-Smtp-Source: AGHT+IEpg2gZ1KK+YR4DOdkUTlgbKjPsimj1kVPjYYYxeLCVQdDI61sxGdFhnlNURMG6DXspvyW4Dg== X-Received: by 2002:a05:6a21:6d85:b0:1a7:7aa0:a5dd with SMTP id wl5-20020a056a216d8500b001a77aa0a5ddmr907068pzb.30.1712691416499; Tue, 09 Apr 2024 12:36:56 -0700 (PDT) X-Received: from localhost.localdomain ([4.155.48.125]) by smtp.gmail.com with ESMTPSA id i26-20020aa787da000000b006ecbcbd2293sm9062104pfo.173.2024.04.09.12.36.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 12:36:56 -0700 (PDT) From: "Taylor Beebe" To: devel@edk2.groups.io Cc: Rebecca Cran , Liming Gao , Bob Feng , Yuwei Chen Subject: [edk2-devel] [PATCH v3 2/2] BaseTools: Use Stronger Matching for NULL Linked Libraries Date: Tue, 9 Apr 2024 12:36:42 -0700 Message-Id: <20240409193642.484-3-taylor.d.beebe@gmail.com> In-Reply-To: <20240409193642.484-1-taylor.d.beebe@gmail.com> References: <20240409193642.484-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: Tue, 09 Apr 2024 12:36:57 -0700 Resent-From: taylor.d.beebe@gmail.com 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=voOOoFdD; 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. Cc: Rebecca Cran Cc: Liming Gao Cc: Bob Feng Cc: Yuwei Chen Signed-off-by: Taylor Beebe --- 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..6ad7a3b940 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 LibraryClassName[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 LibraryClassName[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 (#117557): https://edk2.groups.io/g/devel/message/117557 Mute This Topic: https://groups.io/mt/105428856/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-