From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.85.221.68, mailfrom: philmd@redhat.com) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by groups.io with SMTP; Thu, 25 Jul 2019 04:04:06 -0700 Received: by mail-wr1-f68.google.com with SMTP id n9so50389258wru.0 for ; Thu, 25 Jul 2019 04:04:05 -0700 (PDT) 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=gzCm7GYVTiKJgfEsyq5WHqD3M7p+92E+7BWOTAb2I3k=; b=DkOSBhY3ALNS1a1k5QPcCJxEXk/jsmMhdrzU9bHPqehLnyrai3vXzLjwkVNcVGCuhQ 2zwKY4ENvQtoafxITDekgTuaCINER5kPZODEFqP7D0TAZYXIQl3SrSybVPDsLIHJiSqa z4kNMTj8R3ImNVd4Do261PsgPkgvPzqrUePGSahfCHuyK/zzvt5r3yAKvTf45Qj986C/ xK2NSAARcemWepkXs0Q45UBeQJRxaGQRcNyoz756CtcHC7VTE1tFo0cShOKr2qCTpRoq Ulhf2J5AyvkrL7BES1eAP67iBm9iObQ8MVcDpiV90slpL25/C4BvjgKLdsT/JC5kgXQI VieQ== X-Gm-Message-State: APjAAAW3O5Qce8f48+CwvF+r8Y67YU73OUKAyBZIfkMRg3RfATtFURZB pQEtYXXTyZ/vr+OWfoiLjKEk2Q== X-Google-Smtp-Source: APXvYqz5DEdTZ+nP4rp+Lem/lGDJoMwr8oRLbz9zYFRZvARjbFOqMn/KFH9+sPXtIt8fUI/m9oe3Ww== X-Received: by 2002:a5d:56cb:: with SMTP id m11mr93114409wrw.255.1564052644456; Thu, 25 Jul 2019 04:04:04 -0700 (PDT) Return-Path: Received: from [192.168.1.37] (190.red-81-40-121.staticip.rima-tde.net. [81.40.121.190]) by smtp.gmail.com with ESMTPSA id l8sm88268727wrg.40.2019.07.25.04.04.03 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jul 2019 04:04:03 -0700 (PDT) Subject: Re: [edk2-devel] [PATCH V2] BaseTools:Add extra debugging message To: devel@edk2.groups.io, zhijux.fan@intel.com Cc: Max Knutsen , Bob Feng , Liming Gao References: <20190725030217.16596-1-zhijux.fan@intel.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Openpgp: id=89C1E78F601EE86C867495CBA2A3FD6EDEADC0DE; url=http://pgp.mit.edu/pks/lookup?op=get&search=0xA2A3FD6EDEADC0DE Message-ID: <1476db70-06ee-2a5f-c475-88ef34e5a1fd@redhat.com> Date: Thu, 25 Jul 2019 13:04:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190725030217.16596-1-zhijux.fan@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Nit in subject, "BaseTools:Add extra debugging message" On 7/25/19 5:02 AM, Fan, ZhijuX wrote: > From: Max Knutsen > > BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=2014 > > 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/Source/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, IsCompatibleMode): > return UniObjectClass > > for File in FileList: > - if os.path.isfile(File): > - Lines = 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) > + try: > + if os.path.isfile(File): > + Lines = 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, "SearchString: Error while processing file", File=File, RaiseError=False) > + raise > > UniObjectClass.ReToken() > > diff --git a/BaseTools/Source/Python/Trim/Trim.py b/BaseTools/Source/Python/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, TrimLong): > try: > with open(Source, "r") as File: > Lines = File.readlines() > - except: > + except IOError: > EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source) > + expect: > + EdkLogger.error("Trim", AUTOGEN_ERROR, "TrimPreprocessedFile: Error while processing file", File=Source) > > PreprocessedFile = "" > InjectedFile = "" > Reviewed-by: Philippe Mathieu-Daude