From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::42f; helo=mail-wr1-x42f.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C939821198CC2 for ; Tue, 11 Dec 2018 01:36:16 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id c14so13355536wrr.0 for ; Tue, 11 Dec 2018 01:36:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=wgmjhEY4Elp6tFmojxXu6DjlQg2oDRjydOHCL9OxkH8=; b=fbjkHhrTDj1bpP2v3biY4u0UaaqexlkrFCypycFTQ2MP9IdaJqxKUagpcVN1VH2iiD SgpIsgSuEoveq4BiEsXlNOrLxmg/3LXVPkgzR86TstnZHCBxPgJM9XuHCi/UIKFqdgsC un8h9tbM5zDvStkMMsqI6zX0smqdkHeksB1lM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=wgmjhEY4Elp6tFmojxXu6DjlQg2oDRjydOHCL9OxkH8=; b=aiSEjjoZNNT0gPG8fjOeChchcVYS/QlHdR1fwqluzoEUnI/+Vq3nZ3pNgBWEmdEsUg +63Qbj1nvROOS6VzkD9hAJWdjhI2+eQ8UwluA2Km4SllfQO7TU3EH+LD1bT1XVhrETie kpIYo0YvUwJd4rjEu1tiyHX7tTzRR/va2ipnRNtmjy/DZ1bIBsw22ztCFoYZy8K4swLD 0fi8OBZpnv91aKUSX4Ep05S7HNO0JWycLCFG4r7RUikHEmuLkmRkGZuuHtIZjSNWBew5 Aw02aTM/baVkoa0zQwsVTcG+AXTW7RPmr6wElGuS0669rlrT0pKXVZ5Uvc85jLmAYumm n+wQ== X-Gm-Message-State: AA+aEWaE/5TJae0bEj58JmvymsZ9Y1dxxxtwsrvSL/iAKFWe7df1uwqM NBqkLeZKuELtpAnJ2HjQFotK8A== X-Google-Smtp-Source: AFSGD/XiYJYRnFc407hlEPPYE3mrtewRwpzBybre/7rwKdPFqVhXSeeeHV0T9mfWNFFW85Ia7w+jPA== X-Received: by 2002:adf:9786:: with SMTP id s6mr12660241wrb.283.1544520975021; Tue, 11 Dec 2018 01:36:15 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id a12sm13753121wrm.45.2018.12.11.01.36.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Dec 2018 01:36:14 -0800 (PST) Date: Tue, 11 Dec 2018 09:36:12 +0000 From: Leif Lindholm To: BobCF Cc: edk2-devel@lists.01.org, Liming Gao Message-ID: <20181211093612.hogxlhhw3ol63ssz@bivouac.eciton.net> References: <20181211090325.2340-1-bob.c.feng@intel.com> MIME-Version: 1.0 In-Reply-To: <20181211090325.2340-1-bob.c.feng@intel.com> User-Agent: NeoMutt/20170113 (1.7.2) 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 09:36:17 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Bob, Thanks for cc. I'm happy with all 3 commit messages. Regards, Leif On Tue, Dec 11, 2018 at 05:03:25PM +0800, BobCF wrote: > From: "Feng, Bob C" > > https://bugzilla.tianocore.org/show_bug.cgi?id=1387 > > This patch is going to fix the regression issue which is > introduced by commit bf9e636605188e291d33ab694ff1c5926b6f0800. > > This patch Remove the CopyDict incorrect usage for non-dict > input data. Add a check for CopyDict input. > > 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(-) > > diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/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 = ori_dict.__class__ > + if dict_type not in (dict,OrderedDict): > + return ori_dict > new_dict = dict_type() > for key in ori_dict: > if isinstance(ori_dict[key],(dict,OrderedDict)): > new_dict[key] = CopyDict(ori_dict[key]) > else: > diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/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 = pcd.SkuInfoList.get(skuid) > if TAB_DEFAULT_STORES_DEFAULT not in skuobj.DefaultStoreDict: > PcdDefaultStoreSet = set(defaultstorename for defaultstorename in skuobj.DefaultStoreDict) > mindefaultstorename = DefaultStoreMgr.GetMin(PcdDefaultStoreSet) > - skuobj.DefaultStoreDict[TAB_DEFAULT_STORES_DEFAULT] = CopyDict(skuobj.DefaultStoreDict[mindefaultstorename]) > + skuobj.DefaultStoreDict[TAB_DEFAULT_STORES_DEFAULT] = skuobj.DefaultStoreDict[mindefaultstorename] > return Pcds > > def RecoverCommandLinePcd(self): > def UpdateCommandLineValue(pcd): > if pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD], > @@ -2767,11 +2767,11 @@ class DscBuildData(PlatformBuildClassObject): > for skuid in PcdObj.SkuInfoList: > skuobj = PcdObj.SkuInfoList[skuid] > mindefaultstorename = DefaultStoreObj.GetMin(set(defaultstorename for defaultstorename in skuobj.DefaultStoreDict)) > for defaultstorename in DefaultStores: > if defaultstorename not in skuobj.DefaultStoreDict: > - skuobj.DefaultStoreDict[defaultstorename] = CopyDict(skuobj.DefaultStoreDict[mindefaultstorename]) > + skuobj.DefaultStoreDict[defaultstorename] = skuobj.DefaultStoreDict[mindefaultstorename] > skuobj.HiiDefaultValue = skuobj.DefaultStoreDict[mindefaultstorename] > for skuname, skuid in SkuIds.items(): > if skuname not in PcdObj.SkuInfoList: > nextskuid = self.SkuIdMgr.GetNextSkuId(skuname) > while nextskuid not in PcdObj.SkuInfoList: > -- > 2.19.1.windows.1 >