From nobody Mon May 6 11:16:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+44360+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44360+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1564023849; cv=none; d=zoho.com; s=zohoarc; b=N2Misbk4Y17KdLQgY3Wk3TIkGWpTX31bN0NT3CibfvJuPerogXHGvJQsmd7eeDrwtBvbnI9Og+/NumCFWGSN/l3kW7+M8YZ6HV25D/5GpcyaikgEFv/FR3Tymfz3ByldJzRMNGv2YittK6KzGiHhTCdyQsfjeoZhVRWkIa27YSs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564023849; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=nyABeFXJtReERlZw1l8YZPOgmlPcxBZARGhqM0hc89k=; b=kbK5w9MwjgjewAFPUyTM/zF/GbFKWnMhDuZ/jjl5ToQwbUUcI51bGwwKlfIznxVsqACGQ8MdabyBE12GoKvSKA4qWWv2NtfcpZaf4AxeuLbVjcR9dJepOd9kRuw7JK0XKCwCMByvjJXnze18L+7dHHgWNFGMozF50UwFXXhn+Ro= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44360+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 1564023849261302.7145697068273; Wed, 24 Jul 2019 20:04:09 -0700 (PDT) Return-Path: X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by groups.io with SMTP; Wed, 24 Jul 2019 20:04:08 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jul 2019 20:04:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,305,1559545200"; d="scan'208";a="175078267" X-Received: from zhijufax-mobl.ccr.corp.intel.com ([10.239.196.141]) by orsmga006.jf.intel.com with ESMTP; 24 Jul 2019 20:04:06 -0700 From: "Fan, ZhijuX" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao , "Zhiju . Fan" Subject: [edk2-devel] [PATCH V2] BaseTools:Updata the output encoding of the Popen function Date: Thu, 25 Jul 2019 11:03:12 +0800 Message-Id: <20190725030312.16380-1-zhijux.fan@intel.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,zhijux.fan@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1564023848; bh=jIPJtrg8w6z6dZHCzYoKVqUbNORh2aT907uVvb2f9kk=; h=Cc:Date:From:Reply-To:Subject:To; b=Y6WzD4JroydnAIK8l9z+cL/D1n7h1YhXwZmBB/TIPytyHVRzhNne+1XhbUFR9zVIvjl qKSBUA70LM6j0yulqtBxTSb+GUyoiW9tGKVTUdqqVyOBKzrrTpZMOIJRzeMFmijxU/PFW bJ5jDRZ1xw5ZnldCAN6eM0/yUC6VDUVyZ+Q= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bob Feng BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2015 Not all output works in utf-8, so change the encoding to the default This patch is going to fix that issue. Cc: Bob Feng Cc: Liming Gao Signed-off-by: Zhiju.Fan Reviewed-by: Liming Gao --- BaseTools/Source/Python/Common/Misc.py | 2 +- BaseTools/Source/Python/Common/VpdInfoFile.py | 2 +- BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py | 2 +- .../Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py | 6 ++= +--- BaseTools/Source/Python/Workspace/DscBuildData.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index 9a63463913..36bd2fe364 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1092,7 +1092,7 @@ def ParseFieldValue (Value): p.stderr.close() if err: raise BadExpression("DevicePath: %s" % str(err)) - out =3D out.decode(encoding=3D'utf-8', errors=3D'ignore') + out =3D out.decode() Size =3D len(out.split()) out =3D ','.join(out.split()) return '{' + out + '}', Size diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Sour= ce/Python/Common/VpdInfoFile.py index bc69a9010d..4249b9f899 100644 --- a/BaseTools/Source/Python/Common/VpdInfoFile.py +++ b/BaseTools/Source/Python/Common/VpdInfoFile.py @@ -243,7 +243,7 @@ def CallExtenalBPDGTool(ToolPath, VpdFileName): except Exception as X: EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, ExtraData= =3Dstr(X)) (out, error) =3D PopenObject.communicate() - print(out.decode(encoding=3D'utf-8', errors=3D'ignore')) + print(out.decode()) while PopenObject.returncode is None : PopenObject.wait() =20 diff --git a/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py b/BaseTools/Sou= rce/Python/Pkcs7Sign/Pkcs7Sign.py index 5630df55df..5d4c3a8599 100644 --- a/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py +++ b/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py @@ -116,7 +116,7 @@ if __name__ =3D=3D '__main__': if Process.returncode !=3D 0: print('ERROR: Open SSL command not available. Please verify PATH or s= et OPENSSL_PATH') sys.exit(Process.returncode) - print(Version[0].decode(encoding=3D'utf-8', errors=3D'ignore')) + print(Version[0].decode()) =20 # # Read input file into a buffer and save input filename diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Generat= eKeys.py b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateK= eys.py index f9aed2bf86..6c9b8c464e 100644 --- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py +++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py @@ -78,7 +78,7 @@ if __name__ =3D=3D '__main__': if Process.returncode !=3D 0: print('ERROR: Open SSL command not available. Please verify PATH or s= et OPENSSL_PATH') sys.exit(Process.returncode) - print(Version[0].decode(encoding=3D'utf-8', errors=3D'ignore')) + print(Version[0].decode()) =20 args.PemFileName =3D [] =20 @@ -119,7 +119,7 @@ if __name__ =3D=3D '__main__': # Extract public key from private key into STDOUT # Process =3D subprocess.Popen('%s rsa -in %s -modulus -noout' % (OpenSs= lCommand, Item), stdout=3Dsubprocess.PIPE, stderr=3Dsubprocess.PIPE, shell= =3DTrue) - PublicKeyHexString =3D Process.communicate()[0].decode(encoding=3D'utf= -8', errors=3D'ignore').split(b'=3D')[1].strip() + PublicKeyHexString =3D Process.communicate()[0].decode().split(b'=3D')= [1].strip() if Process.returncode !=3D 0: print('ERROR: Unable to extract public key from private key') sys.exit(Process.returncode) @@ -132,7 +132,7 @@ if __name__ =3D=3D '__main__': # Process =3D subprocess.Popen('%s dgst -sha256 -binary' % (OpenSslComma= nd), stdin=3Dsubprocess.PIPE, stdout=3Dsubprocess.PIPE, stderr=3Dsubprocess= .PIPE, shell=3DTrue) Process.stdin.write (PublicKey) - PublicKeyHash =3D PublicKeyHash + Process.communicate()[0].decode(enco= ding=3D'utf-8', errors=3D'ignore') + PublicKeyHash =3D PublicKeyHash + Process.communicate()[0].decode() if Process.returncode !=3D 0: print('ERROR: Unable to extract SHA 256 hash of public key') sys.exit(Process.returncode) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index 985f877525..620e48fa7f 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1735,7 +1735,7 @@ class DscBuildData(PlatformBuildClassObject): except: EdkLogger.error('Build', COMMAND_FAILURE, 'Can not execute com= mand: %s' % Command) Result =3D Process.communicate() - return Process.returncode, Result[0].decode(encoding=3D'utf-8', er= rors=3D'ignore'), Result[1].decode(encoding=3D'utf-8', errors=3D'ignore') + return Process.returncode, Result[0].decode(), Result[1].decode() =20 @staticmethod def IntToCString(Value, ValueSize): --=20 2.14.1.windows.1 -=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 (#44360): https://edk2.groups.io/g/devel/message/44360 Mute This Topic: https://groups.io/mt/32594595/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-