[edk2-devel] [PATCH] ShellPkg/Ls: Consider UEFI timezone may not be set

Marvin Häuser posted 1 patch 4 years, 6 months ago
Failed in applying to current master (apply log)
ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[edk2-devel] [PATCH] ShellPkg/Ls: Consider UEFI timezone may not be set
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=2294

EFI_RUNTIME_SERVICES.GetTime() might return an unspecified Timezone,
such as when SetTime() has not been called after the RTC was cut off
power. Consider this case by not attempting Timezone translations for
when it is invalid.

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

diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
index adeb987e6ecb..1a65f60c3b44 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
@@ -500,7 +500,7 @@ PrintLsOutput(
       // Change the file time to local time.

       //

       Status = gRT->GetTime(&LocalTime, NULL);

-      if (!EFI_ERROR (Status)) {

+      if (!EFI_ERROR (Status) && (LocalTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE)) {

         if ((Node->Info->CreateTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) &&

             (Node->Info->CreateTime.Month >= 1 && Node->Info->CreateTime.Month <= 12)) {

           //

-- 
2.23.0.windows.1


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

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

Re: [edk2-devel] [PATCH] ShellPkg/Ls: Consider UEFI timezone may not be set
Posted by Gao, Zhichao 4 years, 6 months ago
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>

> -----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] ShellPkg/Ls: Consider UEFI timezone may not be set
> 
> From: Marvin Haeuser <mhaeuser@outlook.de>
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2294
> 
> EFI_RUNTIME_SERVICES.GetTime() might return an unspecified Timezone,
> such as when SetTime() has not been called after the RTC was cut off power.
> Consider this case by not attempting Timezone translations for when it is
> invalid.
> 
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Zhichao Gao <zhichao.gao@intel.com>
> Signed-off-by: Marvin Haeuser <mhaeuser@outlook.de>
> ---
>  ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
> b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
> index adeb987e6ecb..1a65f60c3b44 100644
> --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
> +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
> @@ -500,7 +500,7 @@ PrintLsOutput(
>        // Change the file time to local time.       //       Status = gRT-
> >GetTime(&LocalTime, NULL);-      if (!EFI_ERROR (Status)) {+      if
> (!EFI_ERROR (Status) && (LocalTime.TimeZone !=
> EFI_UNSPECIFIED_TIMEZONE)) {         if ((Node->Info-
> >CreateTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) &&             (Node-
> >Info->CreateTime.Month >= 1 && Node->Info->CreateTime.Month <= 12))
> {           //--
> 2.23.0.windows.1


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

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