public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ShellPkg/Ls: Handle path specified from root
@ 2017-05-12 21:31 Jeff Westfahl
  2017-05-12 22:08 ` Jeff Westfahl
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Westfahl @ 2017-05-12 21:31 UTC (permalink / raw)
  To: edk2-devel; +Cc: Jeff Westfahl, Ruiyu Ni, Jaben Carsey

This fixes 'ls' when specifying a path from the root, like "ls \" from
within a subfolder. Currently, 'ls' will append the specified path to the
current working directory. The correct behavior is to start from the root
of the currently selected filesystem.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
---
 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 52ae18f..b14bbcd 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
@@ -679,7 +679,7 @@ ShellCommandRunLs (
             // We got a valid fully qualified path or we have a CWD
             //
             ASSERT((FullPath == NULL && Size == 0) || (FullPath != NULL));
-            if (StrStr(PathName, L":") == NULL) {
+            if (PathName [0] != L'\\' && StrStr(PathName, L":") == NULL) {
               StrnCatGrow(&FullPath, &Size, gEfiShellProtocol->GetCurDir(NULL), 0);
               if (FullPath == NULL) {
                 ShellCommandLineFreeVarList (Package);
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ShellPkg/Ls: Handle path specified from root
  2017-05-12 21:31 [PATCH] ShellPkg/Ls: Handle path specified from root Jeff Westfahl
@ 2017-05-12 22:08 ` Jeff Westfahl
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Westfahl @ 2017-05-12 22:08 UTC (permalink / raw)
  To: Jeff Westfahl; +Cc: edk2-devel, Ruiyu Ni, Jaben Carsey

Hmm, this one still has a bug. The correct folder is listed, but it prints 
the wrong folder name before listing the contents. I'll fix that and post 
again.

Jeff

On Fri, 12 May 2017, Jeff Westfahl wrote:

> This fixes 'ls' when specifying a path from the root, like "ls \" from
> within a subfolder. Currently, 'ls' will append the specified path to the
> current working directory. The correct behavior is to start from the root
> of the currently selected filesystem.
>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
> ---
> 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 52ae18f..b14bbcd 100644
> --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
> +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
> @@ -679,7 +679,7 @@ ShellCommandRunLs (
>             // We got a valid fully qualified path or we have a CWD
>             //
>             ASSERT((FullPath == NULL && Size == 0) || (FullPath != NULL));
> -            if (StrStr(PathName, L":") == NULL) {
> +            if (PathName [0] != L'\\' && StrStr(PathName, L":") == NULL) {
>               StrnCatGrow(&FullPath, &Size, gEfiShellProtocol->GetCurDir(NULL), 0);
>               if (FullPath == NULL) {
>                 ShellCommandLineFreeVarList (Package);
> -- 
> 2.7.4
>
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-12 22:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-12 21:31 [PATCH] ShellPkg/Ls: Handle path specified from root Jeff Westfahl
2017-05-12 22:08 ` Jeff Westfahl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox