From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0DDED203B85B8 for ; Thu, 17 May 2018 01:00:35 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 May 2018 01:00:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,409,1520924400"; d="scan'208";a="229245903" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga005.fm.intel.com with ESMTP; 17 May 2018 01:00:34 -0700 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 17 May 2018 01:00:34 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 17 May 2018 01:00:34 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.240]) by shsmsx102.ccr.corp.intel.com ([169.254.2.79]) with mapi id 14.03.0319.002; Thu, 17 May 2018 16:00:31 +0800 From: "Ni, Ruiyu" To: =?iso-8859-1?Q?Marvin_H=E4user?= , "edk2-devel@lists.01.org" CC: "Carsey, Jaben" Thread-Topic: [PATCH] ShellPkg/UefiShellCommandLib: Do not error-exit when PlatformLang is missing. Thread-Index: AQHT5M4x2p+7xjSY4kKnvBuynpxkP6QzoH5g Date: Thu, 17 May 2018 08:00:30 +0000 Deferred-Delivery: Thu, 17 May 2018 08:00:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BC9E89A@SHSMSX104.ccr.corp.intel.com> References: In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] ShellPkg/UefiShellCommandLib: Do not error-exit when PlatformLang is missing. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 May 2018 08:00:36 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ruiyu Ni Thanks/Ray > -----Original Message----- > From: Marvin H=E4user > Sent: Sunday, May 6, 2018 8:07 AM > To: edk2-devel@lists.01.org > Cc: Carsey, Jaben ; Ni, Ruiyu > Subject: [PATCH] ShellPkg/UefiShellCommandLib: Do not error-exit when > PlatformLang is missing. >=20 > Currently, when the PlatformLang variable is missing, UefiShellCommandLib > error-exits. To prevent the entire UEFI Shell from failing to load over a > missing variable, "en-US" is assumed when the variable location fails. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Marvin Haeuser > --- > ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c | 9 ++++---- > - > 1 file changed, 4 insertions(+), 5 deletions(-) >=20 > diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c > b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c > index 0df252b42036..dfcfd2e0dd54 100644 > --- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c > +++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c > @@ -81,9 +81,6 @@ CommandInit( > CHAR8 *PlatformLang; >=20 > GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME, > (VOID**)&PlatformLang, NULL); > - if (PlatformLang =3D=3D NULL) { > - return EFI_UNSUPPORTED; > - } >=20 > if (gUnicodeCollation =3D=3D NULL) { > Status =3D gBS->LocateHandleBuffer ( > @@ -120,7 +117,7 @@ CommandInit( > BestLanguage =3D GetBestLanguage ( > Uc->SupportedLanguages, > FALSE, > - PlatformLang, > + ((PlatformLang !=3D NULL) ? PlatformLang : > + "en-US"), > NULL > ); > if (BestLanguage !=3D NULL) { > @@ -132,7 +129,9 @@ CommandInit( > if (Handles !=3D NULL) { > FreePool (Handles); > } > - FreePool (PlatformLang); > + if (PlatformLang !=3D NULL) { > + FreePool (PlatformLang); > + } > } >=20 > return (gUnicodeCollation =3D=3D NULL) ? EFI_UNSUPPORTED : EFI_SUCCESS= ; > -- > 2.17.0.windows.1