From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.85.128.67; helo=mail-wm1-f67.google.com; envelope-from=philmd@redhat.com; receiver=edk2-devel@lists.01.org Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) (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 78B5121962301 for ; Tue, 5 Feb 2019 04:02:13 -0800 (PST) Received: by mail-wm1-f67.google.com with SMTP id a62so3321752wmh.4 for ; Tue, 05 Feb 2019 04:02:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=0XqF9M2LfkzTQY76TFo6dKWXSHQnT4u9TELaHLdCYfI=; b=VTLAUIyEmrTtpn5fq85shVeUqDTXY6mr2KFgjlX9heaUEMIQ9sKpAsazVRrYQC/V0Q s4ZObemJpQZHotq168mKWWjAfDVxLfvicZArX77gD9hW45vy/qiA6XouDcQcVeiZiJXw Q4SP8EuvmGRGKiVpekkoC3neeln61ZMzVkEw0JYLxoGb3vOm+oc1Tw+vQ8UqY/x5vLTk Gh5QqiGsoaYQDK4ar6qC3Fw4jnfY7ji9BoUrVEC93ZeMj6BANqhO/cv2QO+9Qg34ca+z uEB38HJVl1Z4Diek0Yx6kk1MfRrOrTroTC9JJzVhEao0Wpd4S3kCmrMdoDjj16hL9P9+ V1xg== X-Gm-Message-State: AHQUAuZM8Qi+SwUYjrmRAII1NG4obIwZ9Y6q30sIIjvtuKnRPicWIN4a 577jfNGtAfu6bCSS7OzO26M3cA== X-Google-Smtp-Source: AHgI3IZPU2+l6E8NTR2sgUP/+3piJ3SuK7l2H8fMyreLjQ9qCtcqiSBsUi0+/uumynMKmzO+L8PvDw== X-Received: by 2002:a1c:63d5:: with SMTP id x204mr3342947wmb.137.1549368131852; Tue, 05 Feb 2019 04:02:11 -0800 (PST) Received: from [192.168.1.103] (10.red-83-35-153.dynamicip.rima-tde.net. [83.35.153.10]) by smtp.gmail.com with ESMTPSA id q14sm12894324wrw.39.2019.02.05.04.02.10 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 05 Feb 2019 04:02:11 -0800 (PST) To: Laszlo Ersek , edk2-devel@lists.01.org, Liming Gao , Bob Feng References: <20190205012356.31376-1-philmd@redhat.com> From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Openpgp: id=89C1E78F601EE86C867495CBA2A3FD6EDEADC0DE; url=http://pgp.mit.edu/pks/lookup?op=get&search=0xA2A3FD6EDEADC0DE Message-ID: <54f9b083-3753-e7a9-2329-4094deac63d4@redhat.com> Date: Tue, 5 Feb 2019 13:02:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Subject: Re: [PATCH] BaseTools: Fix build failure when specifying multiple BUILDTARGET 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, 05 Feb 2019 12:02:13 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 2/5/19 10:03 AM, Laszlo Ersek wrote: > On 02/05/19 02:23, Philippe Mathieu-Daudé wrote: >> Since 9c2d68c0a299 the build tools default to the python version >> provided by the ${PYTHON} environment variable. >> However the Python3 transition is not effective before d943b0c339fe. > > (1) Do you mean "functional" rather than "effective"? Probably :) > (2) Why is this information relevant for this commit? I see that commit > f8d11e5a4aaa, referenced below, falls between the above two, but I'm > unsure if that has any special relevance. > > If the above paragraph is just background info, that's OK with me, of > course. Yes, I'll reword to explain the tree isn't bisectable there, or drop that background info. >> With Python3, the dict.value() method returns an iterator. >> If a dictionary is updated while an iterator on his keys is used, > > (3) s/his/its/ > >> a RuntimeError is generated. >> Converting the iterator to a list() forces a copy of the mutable >> keys in an immutable list which can be safely iterated. >> >> Commit f8d11e5a4aaa converted various uses but missed one: >> When specifying multiple BUILDTARGET, the first target builds >> successfully, but then the PGen.BuildDatabase._CACHE_ dictionary is >> updated, and the next target accessing it triggers a RuntimeError. > > (4) Can we clarify this please; I think it's not the "next target" that > accesses the dictionary, instead the code accesses the next target in > the dictionary. How about > > s/the next target accessing it/accessing the next target/ > > ? Sure. >> >> Convert this iterator to an immutable list, to solve this build error: >> >> $ build -a IA32 -t GCC5 -b RELEASE -b NOOPT -p OvmfPkg/OvmfPkgIa32.dsc >> [...] >> Processing meta-data ... >> build.py... >> : error C0DE: Unknown fatal error when processing [OvmfPkg/OvmfPkgIa32.dsc] >> >> (Please send email to edk2-devel@lists.01.org for help, attaching following call stack trace!) >> >> (Python 3.5.3 on linux) Traceback (most recent call last): >> File "BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 2387, in Main >> MyBuild.Launch() >> File "BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 2141, in Launch >> self._MultiThreadBuildPlatform() >> File "BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 1921, in _MultiThreadBuildPlatform >> self.Progress >> File "BaseTools/Source/Python/AutoGen/AutoGen.py", line 304, in __init__ >> self._InitWorker(Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs) >> File "BaseTools/Source/Python/AutoGen/AutoGen.py", line 477, in _InitWorker >> for BuildData in PGen.BuildDatabase._CACHE_.values(): >> RuntimeError: dictionary changed size during iteration >> >> Reported-by: Leif Lindholm >> Fixes: f8d11e5a4aaa90bf63b4789f3993dd6d16c60787 >> Contributed-under: TianoCore Contribution Agreement 1.1 >> Signed-off-by: Philippe Mathieu-Daude >> Tested-by: Leif Lindholm >> --- >> BaseTools/Source/Python/AutoGen/AutoGen.py | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py >> index a95d2c710e..12592a2a46 100644 >> --- a/BaseTools/Source/Python/AutoGen/AutoGen.py >> +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py >> @@ -474,7 +474,7 @@ class WorkspaceAutoGen(AutoGen): >> >> # generate the SourcePcdDict and BinaryPcdDict >> PGen = PlatformAutoGen(self, self.MetaFile, Target, Toolchain, Arch) >> - for BuildData in PGen.BuildDatabase._CACHE_.values(): >> + for BuildData in list(PGen.BuildDatabase._CACHE_.values()): >> if BuildData.Arch != Arch: >> continue >> if BuildData.MetaFile.Ext == '.inf': >> > > LGTM :) > > With the commit message updated (as you prefer): > > Acked-by: Laszlo Ersek Thanks! Regards, Phil. > > Thanks > Laszlo >