* [PATCH v2] ShellPkg/Ls: Handle path specified from root
@ 2017-05-15 17:17 Jeff Westfahl
2017-05-15 18:00 ` Carsey, Jaben
0 siblings, 1 reply; 2+ messages in thread
From: Jeff Westfahl @ 2017-05-15 17:17 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 | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
index 8d33392..8eeb2c0 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
@@ -685,6 +685,9 @@ ShellCommandRunLs (
ShellCommandLineFreeVarList (Package);
return SHELL_OUT_OF_RESOURCES;
}
+ if (PathName[0] == L'\\') {
+ while (PathRemoveLastItem(FullPath)) ;
+ }
Size = FullPath != NULL? StrSize(FullPath) : 0;
StrnCatGrow(&FullPath, &Size, L"\\", 0);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] ShellPkg/Ls: Handle path specified from root
2017-05-15 17:17 [PATCH v2] ShellPkg/Ls: Handle path specified from root Jeff Westfahl
@ 2017-05-15 18:00 ` Carsey, Jaben
0 siblings, 0 replies; 2+ messages in thread
From: Carsey, Jaben @ 2017-05-15 18:00 UTC (permalink / raw)
To: Jeff Westfahl, edk2-devel@lists.01.org; +Cc: Ni, Ruiyu
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
> -----Original Message-----
> From: Jeff Westfahl [mailto:jeff.westfahl@ni.com]
> Sent: Monday, May 15, 2017 10:18 AM
> To: edk2-devel@lists.01.org
> Cc: Jeff Westfahl <jeff.westfahl@ni.com>; Ni, Ruiyu <ruiyu.ni@intel.com>;
> Carsey, Jaben <jaben.carsey@intel.com>
> Subject: [edk2][PATCH v2] ShellPkg/Ls: Handle path specified from root
> Importance: High
>
> 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 | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
> b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
> index 8d33392..8eeb2c0 100644
> --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
> +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
> @@ -685,6 +685,9 @@ ShellCommandRunLs (
> ShellCommandLineFreeVarList (Package);
> return SHELL_OUT_OF_RESOURCES;
> }
> + if (PathName[0] == L'\\') {
> + while (PathRemoveLastItem(FullPath)) ;
> + }
> Size = FullPath != NULL? StrSize(FullPath) : 0;
> StrnCatGrow(&FullPath, &Size, L"\\", 0);
> }
> --
> 2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-15 18:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-15 17:17 [PATCH v2] ShellPkg/Ls: Handle path specified from root Jeff Westfahl
2017-05-15 18:00 ` Carsey, Jaben
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox