From nobody Mon May 6 12:42:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+64002+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+64002+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597167954; cv=none; d=zohomail.com; s=zohoarc; b=SNENE3iiRjS6N5m0JSoJbMBZgf+c8KRp0rPs7pQ3biTlDimz+SeyNcjdCIQ/b3s58KY2GyAaWrWfZbQJLj8/Zp6GX7AMVfinGx2IzNpT4tiM3gn0E30hLMjjA0lKdAmikG+b8zLNdpT//P34/sU03FlRdO/wLqxk3S0EVCiMKIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597167954; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=FPck5Nc++QDuO4xQ24jBxBGFriZWjSVY98sbDDFdyBU=; b=GRN1ISJyy2o3+dW5s6DQgxl9Ui2vRK+QUcQ3tM/pL0PDl/RJjpr20PR7URf2JDUqKdRJK1dUTGztwCmcnJZBm7r2BegHqmm/SHWqxU2OrJMUhLmU+rBugIDGcOaBrpZY8q+iPdHRwpIJyuI9ZoMSa9dy0+ttms11hn8RAsu+YVo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+64002+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1597167954933292.41123760504263; Tue, 11 Aug 2020 10:45:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id kwLRYY1788612xSPpa7IDqR6; Tue, 11 Aug 2020 10:45:54 -0700 X-Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.120]) by mx.groups.io with SMTP id smtpd.web12.302.1597167131109162282 for ; Tue, 11 Aug 2020 10:32:11 -0700 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-223-hFk-m0AlO5Sa7_Ah4__nIw-1; Tue, 11 Aug 2020 13:32:06 -0400 X-MC-Unique: hFk-m0AlO5Sa7_Ah4__nIw-1 X-Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8D73B79EC2; Tue, 11 Aug 2020 17:32:04 +0000 (UTC) X-Received: from worklaptop.redhat.com (ovpn-118-49.rdu2.redhat.com [10.10.118.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A4BB10016E8; Tue, 11 Aug 2020 17:32:03 +0000 (UTC) From: "Cole" To: devel@edk2.groups.io Cc: bob.c.feng@intel.com, liming.gao@intel.com, Cole Robinson Subject: [edk2-devel] [PATCH 1/2] BaseTools: fix ucs-2 lookup on python 3.9 Date: Tue, 11 Aug 2020 13:28:17 -0400 Message-Id: <1ded5a5bfc3e3a83eba56fa0875db037e60a7c4e.1597166808.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,crobinso@redhat.com X-Gm-Message-State: 9sS5YnKfARKaRZ3L52o7Xsy1x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1597167954; bh=Gn5YZiVBa7UhzAeltZD4RvIbPduBkMeMJwxkwKUseHw=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=LyuNIjDORq5LjrgFp14ryOCkrCX54H1CYUKgdhJ0irLg9SGICRF1gG7cuVabyCvSbh6 zUg0PAXuIo4dDcP8at2DLumM4dmmUlZ7G5Bs7ZeyQHAX+5uwiqCcrxt0yDgCMAStKUa2s Pxwc5W6kNrpDGYjd3T+B24E4Jil85CRnf34= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" python3.9 changed/fixed codec.register behavior to always replace hyphen with underscore for passed in codec names: https://bugs.python.org/issue37751 So the custom Ucs2Search needs to be adapted to handle 'ucs_2' in addition to existing 'ucs-2' for back compat. This fixes test failures on python3.9, example: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D FAIL: testUtf16InUniFile (CheckUnicodeSourceFiles.Tests) Reviewed-by: Bob Feng Reviewed-by: Yuwei Chen ---------------------------------------------------------------------- Traceback (most recent call last): File "/builddir/build/BUILD/edk2-edk2-stable202002/BaseTools/Source/Pytho= n/AutoGen/UniClassObject.py", line 375, in PreProcess FileIn =3D UniFileClassObject.OpenUniFile(LongFilePath(File.Path)) File "/builddir/build/BUILD/edk2-edk2-stable202002/BaseTools/Source/Pytho= n/AutoGen/UniClassObject.py", line 303, in OpenUniFile UniFileClassObject.VerifyUcs2Data(FileIn, FileName, Encoding) File "/builddir/build/BUILD/edk2-edk2-stable202002/BaseTools/Source/Pytho= n/AutoGen/UniClassObject.py", line 312, in VerifyUcs2Data Ucs2Info =3D codecs.lookup('ucs-2') LookupError: unknown encoding: ucs-2 Signed-off-by: Cole Robinson --- BaseTools/Source/Python/AutoGen/UniClassObject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py b/BaseTools/= Source/Python/AutoGen/UniClassObject.py index b2895f7e5c..883c2356e0 100644 --- a/BaseTools/Source/Python/AutoGen/UniClassObject.py +++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py @@ -152,7 +152,7 @@ class Ucs2Codec(codecs.Codec): =20 TheUcs2Codec =3D Ucs2Codec() def Ucs2Search(name): - if name =3D=3D 'ucs-2': + if name in ['ucs-2', 'ucs_2']: return codecs.CodecInfo( name=3Dname, encode=3DTheUcs2Codec.encode, --=20 2.26.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#64002): https://edk2.groups.io/g/devel/message/64002 Mute This Topic: https://groups.io/mt/76131665/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon May 6 12:42:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+64001+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+64001+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597167950; cv=none; d=zohomail.com; s=zohoarc; b=XxIk0p0rNvbyT/zW/jBqmKRuYbp/Ahsd+A5OZtoYBX1/Tq+8DbUFdt/eOzk78ZFPDAA1+/jdk0oW0cVe6e2nAOjBEc1EMMNI5/6FZw71U83mA0m836N/DTkecbV3g24er4PEYQ9tXSqMuGzBugkIOYPo3nSgkJVBd5rFFr6IpnY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597167950; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=A6vLK46NZED9EHsW6/By/+NUsZQUg41VnXNobW4kylg=; b=EAfO0rj84KlRSGaHnrLMNV/n1DdlUjQwRmGlD/Vj1OLoc+efNpMchx03wEl28PVf4PipttGF6Td0d71tbbmpyTAEHXYPuOvhtvPPbB67PmjBrNuSL6l1uw+9zfnBQsZvESJgeg+QK4LF4bFNldPc1i44o4EvFUgC1ppG+m9Lunc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+64001+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1597167950804604.048454442926; Tue, 11 Aug 2020 10:45:50 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id xYBMYY1788612x4h9I47Zto9; Tue, 11 Aug 2020 10:45:49 -0700 X-Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web10.308.1597167128927113654 for ; Tue, 11 Aug 2020 10:32:09 -0700 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-306-iTQ_lReGOUaohxosiqIIng-1; Tue, 11 Aug 2020 13:32:06 -0400 X-MC-Unique: iTQ_lReGOUaohxosiqIIng-1 X-Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 49B0F8015F0; Tue, 11 Aug 2020 17:32:05 +0000 (UTC) X-Received: from worklaptop.redhat.com (ovpn-118-49.rdu2.redhat.com [10.10.118.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id B85351001281; Tue, 11 Aug 2020 17:32:04 +0000 (UTC) From: "Cole" To: devel@edk2.groups.io Cc: bob.c.feng@intel.com, liming.gao@intel.com, Cole Robinson Subject: [edk2-devel] [PATCH 2/2] BaseTools: Work around array.array.tostring() removal in python 3.9 Date: Tue, 11 Aug 2020 13:28:18 -0400 Message-Id: <95d3490d62f9d320e61efa10cba7424a6f626f66.1597166808.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,crobinso@redhat.com X-Gm-Message-State: xU9BoF52sAnNTKFWeNBbfYzjx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1597167949; bh=xIv+lywKS7D5bhH4aKNvQsGTTLpg5qkYZ+ujwNvpIcM=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=UIlFSNdg6X9rZMyQmxvqBhKPfrxHIcaC1JodGv/QpcRj1UwU/TVIZO9CqEf66EAjhuT qRhHOLqKtTlk8m/sBKK+g0Jsg8Notu1j2+09DGrdV0qB9LxSViDa/iD90H2oAJC7tiBve daBOsMzDuVL9PMz9If30GJum4SPv4TkEN1I= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" In python3, array.array.tostring() was a compat alias for tobytes(). tostring() was removed in python 3.9. Convert this to use tolist() which should be valid for all python versions. This fixes this build error on python3.9: (Python 3.9.0b5 on linux) Traceback (most recent call last): File "/root/edk2/edk2-edk2-stable202002/BaseTools/BinWrappers/PosixLike/.= ./../Source/Python/Trim/Trim.py", line 593, in Main GenerateVfrBinSec(CommandOptions.ModuleName, CommandOptions.DebugDir, C= ommandOptions.OutputFile) File "/root/edk2/edk2-edk2-stable202002/BaseTools/BinWrappers/PosixLike/.= ./../Source/Python/Trim/Trim.py", line 449, in GenerateVfrBinSec VfrUniOffsetList =3D GetVariableOffset(MapFileName, EfiFileName, VfrNam= eList) File "/root/edk2/edk2-edk2-stable202002/BaseTools/Source/Python/Common/Mi= sc.py", line 88, in GetVariableOffset return _parseForGCC(lines, efifilepath, varnames) File "/root/edk2/edk2-edk2-stable202002/BaseTools/Source/Python/Common/Mi= sc.py", line 151, in _parseForGCC efisecs =3D PeImageClass(efifilepath).SectionHeaderList File "/root/edk2/edk2-edk2-stable202002/BaseTools/Source/Python/Common/Mi= sc.py", line 1638, in __init__ if ByteArray.tostring() !=3D b'PE\0\0': AttributeError: 'array.array' object has no attribute 'tostring' Signed-off-by: Cole Robinson Reviewed-by: Bob Feng Reviewed-by: Yuwei Chen --- BaseTools/Source/Python/Common/Misc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index ad55671080..4be7957138 100755 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1635,7 +1635,7 @@ class PeImageClass(): ByteArray =3D array.array('B') ByteArray.fromfile(PeObject, 4) # PE signature should be 'PE\0\0' - if ByteArray.tostring() !=3D b'PE\0\0': + if ByteArray.tolist() !=3D [ord('P'), ord('E'), 0, 0]: self.ErrorInfo =3D self.FileName + ' has no valid PE signature= PE00' return =20 --=20 2.26.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#64001): https://edk2.groups.io/g/devel/message/64001 Mute This Topic: https://groups.io/mt/76131663/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-