[edk2-devel] [PATCH] UefiShellCommandLib: Default to first found UC for unsupported PlatformLang

Marvin Häuser posted 1 patch 4 years, 6 months ago
Failed in applying to current master (apply log)
ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
[edk2-devel] [PATCH] UefiShellCommandLib: Default to first found UC for unsupported PlatformLang
Posted by Marvin Häuser 4 years, 6 months ago
From: Marvin Haeuser <mhaeuser@outlook.de>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2300

On some firmwares PlatformLang is set to the local language (e.g. ru-RU),
however there is no Unicode Collation protocol instance that supports it.
As for missing PlatformLang, fall back to the first found instance.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Marvin Haeuser <mhaeuser@outlook.de>
---
 ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
index 4c48b65fbc1d..345808a1eac6 100644
--- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
+++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
@@ -107,9 +107,13 @@ CommandInit(
 

       //

       // Without clue provided use the first Unicode Collation2 protocol.

+      // This may happen when PlatformLang is NULL or when no installed Unicode

+      // Collation2 protocol instance supports PlatformLang.

       //

-      if (PlatformLang == NULL) {

+      if (gUnicodeCollation == NULL) {

         gUnicodeCollation = Uc;

+      }

+      if (PlatformLang == NULL) {

         break;

       }

 

-- 
2.23.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#49260): https://edk2.groups.io/g/devel/message/49260
Mute This Topic: https://groups.io/mt/35954837/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH] UefiShellCommandLib: Default to first found UC for unsupported PlatformLang
Posted by Gao, Zhichao 4 years, 5 months ago
Hi Ray,

This patch would set the default language of shell to the first found language instead of ASSERT when the matched language is not found. What do you think of this change? I don't know the reason of assert. If it is required to ASSERT to show the user the shell language should be matched with the platform language. Then the patch is inappropriate. If not, the patch is fine.

Thanks,
Zhichao

> -----Original Message-----
> From: Marvin Häuser [mailto:Marvin.Haeuser@outlook.com]
> Sent: Sunday, October 20, 2019 8:09 PM
> To: devel@edk2.groups.io
> Cc: vit9696@protonmail.com; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao
> <zhichao.gao@intel.com>
> Subject: [PATCH] UefiShellCommandLib: Default to first found UC for
> unsupported PlatformLang
> 
> From: Marvin Haeuser <mhaeuser@outlook.de>
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2300
> 
> On some firmwares PlatformLang is set to the local language (e.g. ru-RU),
> however there is no Unicode Collation protocol instance that supports it.
> As for missing PlatformLang, fall back to the first found instance.
> 
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Zhichao Gao <zhichao.gao@intel.com>
> Signed-off-by: Marvin Haeuser <mhaeuser@outlook.de>
> ---
>  ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> index 4c48b65fbc1d..345808a1eac6 100644
> --- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> +++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> @@ -107,9 +107,13 @@ CommandInit(
>         //       // Without clue provided use the first Unicode Collation2 protocol.+
> // This may happen when PlatformLang is NULL or when no installed
> Unicode+      // Collation2 protocol instance supports PlatformLang.       //-      if
> (PlatformLang == NULL) {+      if (gUnicodeCollation == NULL)
> {         gUnicodeCollation = Uc;+      }+      if (PlatformLang == NULL)
> {         break;       } --
> 2.23.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#49411): https://edk2.groups.io/g/devel/message/49411
Mute This Topic: https://groups.io/mt/35954837/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH] UefiShellCommandLib: Default to first found UC for unsupported PlatformLang
Posted by Ni, Ray 4 years, 5 months ago
I am ok to this change.

> -----Original Message-----
> From: Gao, Zhichao <zhichao.gao@intel.com>
> Sent: Thursday, October 24, 2019 9:25 AM
> To: Marvin Häuser <Marvin.Haeuser@outlook.com>; devel@edk2.groups.io
> Cc: vit9696@protonmail.com; Ni, Ray <ray.ni@intel.com>
> Subject: RE: [PATCH] UefiShellCommandLib: Default to first found UC for
> unsupported PlatformLang
> 
> Hi Ray,
> 
> This patch would set the default language of shell to the first found language
> instead of ASSERT when the matched language is not found. What do you
> think of this change? I don't know the reason of assert. If it is required to
> ASSERT to show the user the shell language should be matched with the
> platform language. Then the patch is inappropriate. If not, the patch is fine.
> 
> Thanks,
> Zhichao
> 
> > -----Original Message-----
> > From: Marvin Häuser [mailto:Marvin.Haeuser@outlook.com]
> > Sent: Sunday, October 20, 2019 8:09 PM
> > To: devel@edk2.groups.io
> > Cc: vit9696@protonmail.com; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao
> > <zhichao.gao@intel.com>
> > Subject: [PATCH] UefiShellCommandLib: Default to first found UC for
> > unsupported PlatformLang
> >
> > From: Marvin Haeuser <mhaeuser@outlook.de>
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2300
> >
> > On some firmwares PlatformLang is set to the local language (e.g.
> > ru-RU), however there is no Unicode Collation protocol instance that
> supports it.
> > As for missing PlatformLang, fall back to the first found instance.
> >
> > Cc: Ray Ni <ray.ni@intel.com>
> > Cc: Zhichao Gao <zhichao.gao@intel.com>
> > Signed-off-by: Marvin Haeuser <mhaeuser@outlook.de>
> > ---
> >  ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c | 6
> +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git
> > a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> > b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> > index 4c48b65fbc1d..345808a1eac6 100644
> > --- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> > +++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> > @@ -107,9 +107,13 @@ CommandInit(
> >         //       // Without clue provided use the first Unicode Collation2
> protocol.+
> > // This may happen when PlatformLang is NULL or when no installed
> > Unicode+      // Collation2 protocol instance supports PlatformLang.       //-
> if
> > (PlatformLang == NULL) {+      if (gUnicodeCollation == NULL)
> > {         gUnicodeCollation = Uc;+      }+      if (PlatformLang == NULL)
> > {         break;       } --
> > 2.23.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#49949): https://edk2.groups.io/g/devel/message/49949
Mute This Topic: https://groups.io/mt/35954837/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH] UefiShellCommandLib: Default to first found UC for unsupported PlatformLang
Posted by Gao, Zhichao 4 years, 5 months ago
Then there is no requirement to force ASSERT when the platform Language is mismatch with the shell language.
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>

> -----Original Message-----
> From: Ni, Ray
> Sent: Tuesday, November 5, 2019 11:03 AM
> To: Gao, Zhichao <zhichao.gao@intel.com>; Marvin Häuser
> <Marvin.Haeuser@outlook.com>; devel@edk2.groups.io
> Cc: vit9696@protonmail.com
> Subject: RE: [PATCH] UefiShellCommandLib: Default to first found UC for
> unsupported PlatformLang
> 
> I am ok to this change.
> 
> > -----Original Message-----
> > From: Gao, Zhichao <zhichao.gao@intel.com>
> > Sent: Thursday, October 24, 2019 9:25 AM
> > To: Marvin Häuser <Marvin.Haeuser@outlook.com>;
> devel@edk2.groups.io
> > Cc: vit9696@protonmail.com; Ni, Ray <ray.ni@intel.com>
> > Subject: RE: [PATCH] UefiShellCommandLib: Default to first found UC
> > for unsupported PlatformLang
> >
> > Hi Ray,
> >
> > This patch would set the default language of shell to the first found
> > language instead of ASSERT when the matched language is not found.
> > What do you think of this change? I don't know the reason of assert.
> > If it is required to ASSERT to show the user the shell language should
> > be matched with the platform language. Then the patch is inappropriate. If
> not, the patch is fine.
> >
> > Thanks,
> > Zhichao
> >
> > > -----Original Message-----
> > > From: Marvin Häuser [mailto:Marvin.Haeuser@outlook.com]
> > > Sent: Sunday, October 20, 2019 8:09 PM
> > > To: devel@edk2.groups.io
> > > Cc: vit9696@protonmail.com; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao
> > > <zhichao.gao@intel.com>
> > > Subject: [PATCH] UefiShellCommandLib: Default to first found UC for
> > > unsupported PlatformLang
> > >
> > > From: Marvin Haeuser <mhaeuser@outlook.de>
> > >
> > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2300
> > >
> > > On some firmwares PlatformLang is set to the local language (e.g.
> > > ru-RU), however there is no Unicode Collation protocol instance that
> > supports it.
> > > As for missing PlatformLang, fall back to the first found instance.
> > >
> > > Cc: Ray Ni <ray.ni@intel.com>
> > > Cc: Zhichao Gao <zhichao.gao@intel.com>
> > > Signed-off-by: Marvin Haeuser <mhaeuser@outlook.de>
> > > ---
> > >  ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c | 6
> > +++++-
> > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > >
> > > diff --git
> > > a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> > > b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> > > index 4c48b65fbc1d..345808a1eac6 100644
> > > --- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> > > +++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> > > @@ -107,9 +107,13 @@ CommandInit(
> > >         //       // Without clue provided use the first Unicode Collation2
> > protocol.+
> > > // This may happen when PlatformLang is NULL or when no installed
> > > Unicode+      // Collation2 protocol instance supports PlatformLang.       //-
> > if
> > > (PlatformLang == NULL) {+      if (gUnicodeCollation == NULL)
> > > {         gUnicodeCollation = Uc;+      }+      if (PlatformLang == NULL)
> > > {         break;       } --
> > > 2.23.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#49952): https://edk2.groups.io/g/devel/message/49952
Mute This Topic: https://groups.io/mt/35954837/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-