From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: bob.c.feng@intel.com) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by groups.io with SMTP; Thu, 01 Aug 2019 05:19:35 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Aug 2019 05:19:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,334,1559545200"; d="scan'208";a="175232466" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga003.jf.intel.com with ESMTP; 01 Aug 2019 05:19:34 -0700 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 1 Aug 2019 05:19:34 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 1 Aug 2019 05:19:33 -0700 Received: from shsmsx105.ccr.corp.intel.com ([169.254.11.15]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.65]) with mapi id 14.03.0439.000; Thu, 1 Aug 2019 20:19:31 +0800 From: "Bob Feng" To: "devel@edk2.groups.io" , "Fan, ZhijuX" CC: Max Knutsen , "Gao, Liming" Subject: Re: [edk2-devel] [PATCH V2] BaseTools:Add extra debugging message Thread-Topic: [edk2-devel] [PATCH V2] BaseTools:Add extra debugging message Thread-Index: AQHVQpV15biX/wWklkKYYxKUxZyUdqbmQNmA Date: Thu, 1 Aug 2019 12:19:31 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D160B513D3@SHSMSX105.ccr.corp.intel.com> References: <20190725030217.16596-1-zhijux.fan@intel.com> In-Reply-To: <20190725030217.16596-1-zhijux.fan@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDlhM2Y1NmQtZDVlYi00YmMwLTllMTEtOTQ5MTg5MDBlZTg5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiMmJvdm1YNjA1bDFDYzdZc0d3SmV6aUdETUcwbUNxbU1QT09uem9wUTNvQUQwMGhMZkRWUGpkc0V1YTJySHo3SyJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: bob.c.feng@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Zhiju, There is a typo in this patch. See it inline. Thanks, Bob -----Original Message----- From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Fan,= ZhijuX Sent: Thursday, July 25, 2019 11:02 AM To: devel@edk2.groups.io Cc: Max Knutsen ; Feng, Bob C ; Gao, Liming ; Fan, ZhijuX Subject: [edk2-devel] [PATCH V2] BaseTools:Add extra debugging message From: Max Knutsen BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2014 Add extra debugging to improve error identification. Error while processing file if the file is read incorrectly This patch is going to fix that issue. Cc: Bob Feng Cc: Liming Gao Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/AutoGen/StrGather.py | 16 ++++++++++------ BaseTools/Source/Python/Trim/Trim.py | 4 +++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/StrGather.py b/BaseTools/Sour= ce/Python/AutoGen/StrGather.py index 2e4671a433..eed30388be 100644 --- a/BaseTools/Source/Python/AutoGen/StrGather.py +++ b/BaseTools/Source/Python/AutoGen/StrGather.py @@ -526,12 +526,16 @@ def SearchString(UniObjectClass, FileList, IsCompati= bleMode): return UniObjectClass =20 for File in FileList: - if os.path.isfile(File): - Lines =3D open(File, 'r') - for Line in Lines: - for StrName in STRING_TOKEN.findall(Line): - EdkLogger.debug(EdkLogger.DEBUG_5, "Found string iden= tifier: " + StrName) - UniObjectClass.SetStringReferenced(StrName) + try: + if os.path.isfile(File): + Lines =3D open(File, 'r') + for Line in Lines: + for StrName in STRING_TOKEN.findall(Line): + EdkLogger.debug(EdkLogger.DEBUG_5, "Found string = identifier: " + StrName) + UniObjectClass.SetStringReferenced(StrName) + except: + EdkLogger.error("UnicodeStringGather", AUTOGEN_ERROR, "Search= String: Error while processing file", File=3DFile, RaiseError=3DFalse) + raise =20 UniObjectClass.ReToken() =20 diff --git a/BaseTools/Source/Python/Trim/Trim.py b/BaseTools/Source/Pytho= n/Trim/Trim.py index 43119bd7ff..8767b67f7e 100644 --- a/BaseTools/Source/Python/Trim/Trim.py +++ b/BaseTools/Source/Python/Trim/Trim.py @@ -73,8 +73,10 @@ def TrimPreprocessedFile(Source, Target, ConvertHex, Tr= imLong): try: with open(Source, "r") as File: Lines =3D File.readlines() - except: + except IOError: EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=3DSource) + expect: Typo here. expect should except + EdkLogger.error("Trim", AUTOGEN_ERROR, "TrimPreprocessedFile: Err= or while processing file", File=3DSource) =20 PreprocessedFile =3D "" InjectedFile =3D "" --=20 2.14.1.windows.1