From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BAC8D21191720 for ; Tue, 11 Dec 2018 05:43:24 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2018 05:43:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,342,1539673200"; d="scan'208";a="282692817" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga005.jf.intel.com with ESMTP; 11 Dec 2018 05:43:24 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 11 Dec 2018 05:43:23 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.203]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.59]) with mapi id 14.03.0415.000; Tue, 11 Dec 2018 21:43:22 +0800 From: "Gao, Liming" To: "Feng, Bob C" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [Patch V3] BaseTools: Fixed bugs in CopyDict function Thread-Index: AQHUkTBqa66cEoBu4UGkTew6TIXs0qV5jItw Date: Tue, 11 Dec 2018 13:43:21 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E38A29C@SHSMSX104.ccr.corp.intel.com> References: <20181211090325.2340-1-bob.c.feng@intel.com> In-Reply-To: <20181211090325.2340-1-bob.c.feng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZmYyNDliMjQtMTY2Yi00NzUzLWE4ZjUtNTY1ZWNlMWEzMjUwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiSFNJRzZlSXdXNWFRcGM2UHVlUzFcL0V3eXNBWXk4NkZqV1dvUk5pOXM1cVZpb0RWemVvZVNEbXcrVXpDQ0pNeEEifQ== dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch V3] BaseTools: Fixed bugs in CopyDict function X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Dec 2018 13:43:24 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Bo= bCF > Sent: Tuesday, December 11, 2018 5:03 PM > To: edk2-devel@lists.01.org > Cc: Gao, Liming Reviewed-by: Liming Gao > Subject: [edk2] [Patch V3] BaseTools: Fixed bugs in CopyDict function >=20 > From: "Feng, Bob C" >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D1387 >=20 > This patch is going to fix the regression issue which is > introduced by commit bf9e636605188e291d33ab694ff1c5926b6f0800. >=20 > This patch Remove the CopyDict incorrect usage for non-dict > input data. Add a check for CopyDict input. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Bob Feng > Cc: Liming Gao > Cc: Leif Lindholm > --- > BaseTools/Source/Python/Common/Misc.py | 2 ++ > BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++-- > 2 files changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Py= thon/Common/Misc.py > index b063f064fb..6a22d01012 100644 > --- a/BaseTools/Source/Python/Common/Misc.py > +++ b/BaseTools/Source/Python/Common/Misc.py > @@ -2137,10 +2137,12 @@ def PackByteFormatGUID(Guid): > # > # @retval new dict or orderdict > # > def CopyDict(ori_dict): > dict_type =3D ori_dict.__class__ > + if dict_type not in (dict,OrderedDict): > + return ori_dict > new_dict =3D dict_type() > for key in ori_dict: > if isinstance(ori_dict[key],(dict,OrderedDict)): > new_dict[key] =3D CopyDict(ori_dict[key]) > else: > diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTool= s/Source/Python/Workspace/DscBuildData.py > index b485c75a84..4543ae7dc0 100644 > --- a/BaseTools/Source/Python/Workspace/DscBuildData.py > +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py > @@ -972,11 +972,11 @@ class DscBuildData(PlatformBuildClassObject): > for skuid in pcd.SkuInfoList: > skuobj =3D pcd.SkuInfoList.get(skuid) > if TAB_DEFAULT_STORES_DEFAULT not in skuobj.DefaultStore= Dict: > PcdDefaultStoreSet =3D set(defaultstorename for def= aultstorename in skuobj.DefaultStoreDict) > mindefaultstorename =3D DefaultStoreMgr.GetMin(PcdDe= faultStoreSet) > - skuobj.DefaultStoreDict[TAB_DEFAULT_STORES_DEFAULT] = =3D > CopyDict(skuobj.DefaultStoreDict[mindefaultstorename]) > + skuobj.DefaultStoreDict[TAB_DEFAULT_STORES_DEFAULT] = =3D skuobj.DefaultStoreDict[mindefaultstorename] > return Pcds >=20 > def RecoverCommandLinePcd(self): > def UpdateCommandLineValue(pcd): > if pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BU= ILD], > @@ -2767,11 +2767,11 @@ class DscBuildData(PlatformBuildClassObject): > for skuid in PcdObj.SkuInfoList: > skuobj =3D PcdObj.SkuInfoList[skuid] > mindefaultstorename =3D DefaultStoreObj.GetMin(set(d= efaultstorename for defaultstorename in > skuobj.DefaultStoreDict)) > for defaultstorename in DefaultStores: > if defaultstorename not in skuobj.DefaultStoreDi= ct: > - skuobj.DefaultStoreDict[defaultstorename] = =3D > CopyDict(skuobj.DefaultStoreDict[mindefaultstorename]) > + skuobj.DefaultStoreDict[defaultstorename] = =3D skuobj.DefaultStoreDict[mindefaultstorename] > skuobj.HiiDefaultValue =3D skuobj.DefaultStoreDict[m= indefaultstorename] > for skuname, skuid in SkuIds.items(): > if skuname not in PcdObj.SkuInfoList: > nextskuid =3D self.SkuIdMgr.GetNextSkuId(skuname) > while nextskuid not in PcdObj.SkuInfoList: > -- > 2.19.1.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel