summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellLevel2CommandsLib
AgeCommit message (Collapse)AuthorFilesLines
2026-08-27ShellPkg/Ls: Initialize list pointer variableArtem Senichev1-0/+2
Using an uninitialized variable resulted in a system exception when the user typed the `ls -r` command. ShellOpenFileMetaArg() only allocates a list head when this is NULL, and appends to whatever it points at otherwise. Signed-off-by: Artem Senichev <artemsen@gmail.com>
2026-08-04ShellPkg/Ls: Remove double-free callsPierre Gondois1-3/+0
Package is always freed in ShellCommandRunLs(). Remove calls to ShellCommandLineFreeVarList() in MainCmdLs(). This double-free was introduced in: commit 531b0aa00211 ("ShellPkg/UefiShellLevel2: Extract MainCmdXXX() function") Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-06-21ShellPkg: Fix the issue that the UEFI Shell layout is messed upQihang Gao1-2/+2
Fixes https://github.com/tianocore/edk2/issues/12689 When the UEFI Shell mapping table is empty (NULL), the console layout becomes corrupted in DEBUG builds. This occurs because the cursor position for the message map: No mapping found. is computed incorrectly under DEBUG mode. The presence of DEBUG output from the Shell driver causes gST->ConOut->Mode->CursorRow to no longer reflect the actual cursor position on the serial port, leading to misplacement of subsequent output. This patch replaces the existing print routine with ShellPrintHiiDefaultEx(). The new function automatically calculates the correct cursor position for the "No mapping found" line, eliminating the dependency on the stale CursorRow value. As a result, the layout remains consistent regardless of DEBUG message activity. Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
2026-04-24ShellPkg/TimeDate: Extract GetTimeZoneFromString() helperPierre Gondois1-39/+57
Extract a GetTimeZoneFromString() function to decrease the size of MainCmdTime(). No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/TimeDate: Extract PrintDaylight() helperPierre Gondois1-16/+31
Extract a PrintDaylight() function to decrease the size of MainCmdTime(). No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/TimeDate: Extract PrintTime() helperPierre Gondois1-51/+39
Extract a PrintTime() function to factorize the code. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/TimeDate: Extract GetCurrentTime() helperPierre Gondois1-14/+34
Extract a GetCurrentTime() function to factorize error messages. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Ls: Extract PrintLsOutputCurr() functionPierre Gondois1-107/+154
Extract a PrintLsOutputCurr() function to decrease the size of PrintLsOutput(). The patch also rationalize the usage of the Found parameter: - Found is updated only when a valid MetaFile is found - a IsRecursive variable is created to distinguish the first PrintLsOutput() call from the other recursive ones. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Ls: Lower PrintLsOutputRec() indentation levelPierre Gondois1-32/+36
Invert some conditions in PrintLsOutputRec() to lower the indentation level. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Ls: Extract PrintLsOutputRec() functionPierre Gondois1-51/+125
Extract a PrintLsOutputRec() function to decrease the size of PrintLsOutput(). No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Ls: Remove unused TimeZone parameterPierre Gondois1-13/+0
The TimeZone parameter is not used. Remove it. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Ls: Hard-code number of files if none foundPierre Gondois1-1/+1
If no file/directory has been found, the number of files/directories must be 0. Hard-code these values to avoid depending on the FileCount/FileSize/DirCount variables. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Ls: Extract GetCorrectedPath() functionPierre Gondois1-39/+56
Extract a GetCorrectedPath() function to decrease the size of PrintLsOutput(). Also free the CorrectedPath in PrintLsOutput() before re-allocating it to prepare for follow-up factorization. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Ls: Move FileMetaArg closing logicPierre Gondois1-2/+4
Move ShellCloseFileMetaArg() calls to close the MetaArg whenever its usage is not needed anymore. This prepares for follow-up factorization. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Ls: Extract UpdateFileLocalTime() functionPierre Gondois1-24/+41
Extract a UpdateFileLocalTime() function to decrease the size of PrintLsOutput(). No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Rm: Extract DeleteDirectory() functionPierre Gondois1-76/+107
Extract a DeleteDirectory() function to decrease the size of CascadeDelete(). The extracted logic is slighly modified to lower the indendation level. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/UefiShellLib: Add IsDotOrDotDot() functionPierre Gondois5-10/+8
Replace existing checks against L"." and L".." by a named function. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-02-24ShellPkg: Replace include guards with #pragma onceMichael Kubacki1-4/+1
Replace traditional `#ifndef`/`#define`/`#endif` include guards with `#pragma` once. `#pragma once` is a widely supported preprocessor directive that prevents header files from being included multiple times. It is supported by all toolchains used to build edk2: GCC, Clang/LLVM, and MSVC. Compared to macro-based include guards, `#pragma once`: - Eliminates the risk of macro name collisions or copy/paste errors where two headers inadvertently use the same guard macro. - Eliminate inconsistency in the way include guard macros are named (e.g., some files use `__FILE_H__`, others use `FILE_H_`, etc.). - Reduces boilerplate (three lines replaced by one). - Avoids polluting the macro namespace with guard symbols. - Can improve build times as the preprocessor can skip re-opening the file entirely, rather than re-reading it to find the matching `#endif` ("multiple-include optimization"). - Note that some compilers may already optimize traditional include guards, by recognzining the idiomatic pattern. This change is made acknowledging that overall portability of the code will technically be reduced, as `#pragma once` is not part of the C/C++ standards. However, this is considered acceptable given: 1. edk2 already defines a subset of supported compilers in BaseTools/Conf/tools_def.template, all of which have supported `#pragma once` for over two decades. 2. There have been concerns raised to the project about inconsistent include guard naming and potential macro collisions. Approximate compiler support dates: - MSVC: Supported since Visual C++ 4.2 (1996) - GCC: Supported since 3.4 (2004) (http://gnu.ist.utl.pt/software/gcc/gcc-3.4/changes.html) - Clang (LLVM based): Since initial release in 2007 Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-12-03ShellPkg/Mv: Harden and optimize trailing-slash trimmingMingjie Shen1-4/+12
- Remove redundant null check in IsValidMove() per CodeQL cpp/redundant-null-check-simple. Specifically, drop the "DestPathWalker != NULL" condition from the trimming loop. Rationale: "DestPathCopy" is allocated at line 181 and checked for NULL at lines 182–183; "DestPathWalker" is initialized from "DestPathCopy" at line 186, so it cannot be NULL. - Cache length once in IsValidMove() and ValidateAndMoveFiles() so the trimming loop avoids repeated StrLen() calls. - Guard the zero-length case before indexing the last character to prevent out-of-bounds access. Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2025-12-02ShellPkg/UefiShellLevel2: Fix CodeQl issuesPierre Gondois1-28/+31
Fix CodeQl issue triggered by the previous patches. - Rm: FileList might be NULL Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-12-02ShellPkg/UefiShellLevel2/Ls: Remove ShellStatus check in MainCmdLs()Pierre Gondois1-5/+0
Remove a check against ShellStatus in MainCmdLs() as there are two consecutive checks without any modification of ShellStatus. Suggested-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-12-02ShellPkg/UefiShellLevel2/Ls: Bail out early in MainCmdLs()Pierre Gondois1-36/+36
If RootPath is NULL, PrintLsOutput() will return an error code of SHELL_OUT_OF_RESOURCES and not print anything: PrintLsOutput() \-StrnCatGrow() if (Source == NULL) { return (*Destination); } Remove paths where FullPath ends up being NULL and bail out early. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-12-02ShellPkg/UefiShellLevel2/Ls: Flatten MainCmdLs()Pierre Gondois1-87/+92
Remove some of the success handling conditions to flatten the MainCmdLs() function. No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-12-02ShellPkg/UefiShellLevel2: Lower indentation level in MainCmdXXX()Pierre Gondois11-1053/+1062
This patch aims to help breaking down the long function present in the ShellPkg and reduce complexity/nested code and conditions. Lower the indentation level in the newly created MainCmdXXX() functions. No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-12-02ShellPkg/UefiShellLevel2: Extract MainCmdXXX() functionPierre Gondois14-627/+951
This patch aims to help breaking down the long function present in the ShellPkg and reduce complexity/nested code and conditions. Extract a MainCmdXXX() function for each shell command. This command contains the possible operations the command aims to operate. The ShellCommandRunXXX() function from which it is extracted is only responsible of: - initializing the shell/command environment - parsing the command parameter and creating a Package - freeing the Package No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-12-02ShellPkg/UefiShellLevel2: Return if ShellCommandLineParse() failedPierre Gondois14-1323/+1355
This patch aims to help breaking down the long function present in the ShellPkg and reduce complexity/nested code and conditions. Return directly if ShellCommandLineParse() returned an error Status. In such case, the "Package" that should be allocated by ShellCommandLineParse() is already freed in: ShellCommandLineParse() \-ShellCommandLineParseEx() \-InternalCommandLineParse() so there is no need to free it with ShellCommandLineFreeVarList(). Note: Cd: Return directly if ShellCommandLineParse() returned an error Status. The initial code was ignoring the error status. Cp: Only check for ShellGetExecutionBreakFlag() if ShellCommandLineParse() returned successfully. If the command line failed to be parsed, there should be no need to check for the execution break flag. No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-10-01ShellPkg/Library: rework Shell...CommandsLib Load.cLeif Lindholm1-35/+32
CodeQL incorrectly flags that LoadedDriverImage might be derferenced while NULL, but the actual code paths make that impossible. Strip several levels of success handling to improve readability for humans and static analyzers both. Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-10-01ShellPkg: Use the newly introduced ShellPrintDefaultEx() aliasPierre Gondois4-6/+6
Make use the newly introduced ShellPrintDefaultEx() alias and replace wherever it is possible: - "ShellPrintEx (-1, -1," with: - "ShellPrintDefaultEx (" No functional change is introduced. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-10-01ShellPkg: Use the newly introduced ShellPrintHiiDefaultEx() aliasPierre Gondois14-238/+190
Make use the newly introduced ShellPrintHiiDefaultEx() alias and replace wherever it is possible: - "ShellPrintHiiEx (-1, -1, NULL," with: - "ShellPrintHiiDefaultEx (" No functional change is introduced. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-06-14ShellPkg/UefiShellLevel2CommandLib: Free Buffer after usePierre Gondois1-0/+2
Free the allocated Buffer after use. Reported-by: Ramesh R <rameshr@ami.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2024-12-09ShellPkg/UefiShellLevel2CommandsLib: Add helper for reset -fwui optionPierre Gondois1-0/+2
Following the UEFI Shell Specification revision 2.2, add helper for the '-fwui' option of the reset command. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2024-10-29ShellPkg: CodeQL FixesOliver Smith-Denny2-1/+4
Includes changes across the module for the following CodeQL rules: - cpp/comparison-with-wider-type - cpp/overflow-buffer - cpp/redundant-null-check-param - cpp/uselesstest Co-authored-by: Taylor Beebe <taylor.d.beebe@gmail.com> Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-10-29ShellPkg: UefiShellLevel2CommandsLib: CodeQL FixesOliver Smith-Denny7-37/+85
Includes changes across the module for the following CodeQL rules: - cpp/comparison-with-wider-type - cpp/overflow-buffer - cpp/redundant-null-check-param - cpp/uselesstest Co-authored-by: Taylor Beebe <taylor.d.beebe@gmail.com> Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-10-04ShellPkg: ShellLevel2StripQuotes: Strip consecutive quotesTormod Volden1-1/+3
When a quotation mark was found, the remaining line would be shifted in-place to get rid of it. However, the "walker" index would still be increased and therefore the first character of the shifted part would be skipped. This means a second quotation mark would not be deleted. Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2024-09-24ShellPkg: add missing linefeed in reset messageHeinrich Schuchardt1-1/+1
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4850 When running 'reset -s' no linefeed is printed. This results in the Linux command line prompt not being printed at the start of a new line: Shell> reset -s Reset with <null string> (0 bytes)user@workstation:/tmp$ Add the missing linefeed. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-12-18ShellPkg: Tidy for code readabilityDaniel Nguyen1-19/+24
Use error handling instead of success handling. Less indented logic is easier to read. Cc: Zhichao Gao <zhichao.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Daniel Nguyen <daniel.nguyen@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
2023-12-08ShellPkg: Fix typosPage Chen8-16/+16
begining->beginning dirve->drive duplicat->duplicate fuly->fully Funciton->Function Functino->Function optioanl->optional poitners->pointers rountine->routine sucessful->successful sucessfully->successfully Signed-off-by: Page Chen <paiching_chen@apple.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Cc: Andrew Fish <afish@apple.com> Message-Id: <829d2bed2a848229d719d7ae7b64ef1a47782720.1699557986.git.paiching_chen@apple.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
2023-03-14ShellPkg/Library: Fix 32-bit truncation of pointer valuesMichael D Kinney1-2/+1
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4366 Update C and UNI files that are incorrectly using %x or %08x instead of %p for pointer values. On 64-bit systems, this is truncating pointer values above 4GB. In reviewing ShellPkg for this issue some unused UNI strings with incorrect format specifiers were removed instead of being fixed. Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
2021-12-07ShellPkg: Apply uncrustify changesMichael Kubacki16-2432/+2725
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the ShellPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
2021-01-19ShellPkg/Ls: sort output by FileName in non-SFO modeLaszlo Ersek1-0/+14
Sorting the LS output in non-SFO mode by FileName is best demonstrated with two examples. (1a) Before: > FS2:\> dir -r apps > Directory of: FS2:\apps\ > 01/01/1970 01:00 <DIR> r 0 . > 12/22/2020 17:53 <DIR> 4,096 X64 > 12/22/2020 17:53 <DIR> 4,096 AARCH64 > 01/01/1970 01:00 <DIR> r 0 .. > 12/22/2020 17:53 <DIR> 4,096 IA32 > 0 File(s) 0 bytes > 5 Dir(s) > Directory of: FS2:\apps\X64\ > 12/22/2020 17:52 18,752 DumpDynPcd.efi > 12/22/2020 17:52 34,240 SmiHandlerProfileInfo.efi > 01/01/1970 01:00 <DIR> r 0 . > 12/22/2020 17:52 11,456 VariableInfo.efi > 12/22/2020 17:52 26,304 MemoryProfileInfo.efi > 12/22/2020 17:53 126,656 AcpiViewApp.efi > 12/22/2020 17:53 38,784 Cpuid.efi > 01/01/1970 01:00 <DIR> r 0 .. > 6 File(s) 256,192 bytes > 2 Dir(s) > Directory of: FS2:\apps\AARCH64\ > 12/22/2020 17:52 32,768 DumpDynPcd.efi > 01/01/1970 01:00 <DIR> r 0 . > 12/22/2020 17:52 20,480 VariableInfo.efi > 12/22/2020 17:52 40,960 MemoryProfileInfo.efi > 12/22/2020 17:53 139,264 AcpiViewApp.efi > 01/01/1970 01:00 <DIR> r 0 .. > 4 File(s) 233,472 bytes > 2 Dir(s) > Directory of: FS2:\apps\IA32\ > 12/22/2020 17:52 17,344 DumpDynPcd.efi > 12/22/2020 17:52 30,720 SmiHandlerProfileInfo.efi > 01/01/1970 01:00 <DIR> r 0 . > 12/22/2020 17:52 10,880 VariableInfo.efi > 12/22/2020 17:52 24,192 MemoryProfileInfo.efi > 12/22/2020 17:53 105,536 AcpiViewApp.efi > 12/22/2020 17:53 36,096 Cpuid.efi > 01/01/1970 01:00 <DIR> r 0 .. > 6 File(s) 224,768 bytes > 2 Dir(s) (1b) After: > FS2:\> dir -r apps > Directory of: FS2:\apps\ > 01/01/1970 01:00 <DIR> r 0 . > 01/01/1970 01:00 <DIR> r 0 .. > 12/22/2020 17:53 <DIR> 4,096 AARCH64 > 12/22/2020 17:53 <DIR> 4,096 IA32 > 12/22/2020 17:53 <DIR> 4,096 X64 > 0 File(s) 0 bytes > 5 Dir(s) > Directory of: FS2:\apps\X64\ > 01/01/1970 01:00 <DIR> r 0 . > 01/01/1970 01:00 <DIR> r 0 .. > 12/22/2020 17:53 126,656 AcpiViewApp.efi > 12/22/2020 17:53 38,784 Cpuid.efi > 12/22/2020 17:52 18,752 DumpDynPcd.efi > 12/22/2020 17:52 26,304 MemoryProfileInfo.efi > 12/22/2020 17:52 34,240 SmiHandlerProfileInfo.efi > 12/22/2020 17:52 11,456 VariableInfo.efi > 6 File(s) 256,192 bytes > 2 Dir(s) > Directory of: FS2:\apps\AARCH64\ > 01/01/1970 01:00 <DIR> r 0 . > 01/01/1970 01:00 <DIR> r 0 .. > 12/22/2020 17:53 139,264 AcpiViewApp.efi > 12/22/2020 17:52 32,768 DumpDynPcd.efi > 12/22/2020 17:52 40,960 MemoryProfileInfo.efi > 12/22/2020 17:52 20,480 VariableInfo.efi > 4 File(s) 233,472 bytes > 2 Dir(s) > Directory of: FS2:\apps\IA32\ > 01/01/1970 01:00 <DIR> r 0 . > 01/01/1970 01:00 <DIR> r 0 .. > 12/22/2020 17:53 105,536 AcpiViewApp.efi > 12/22/2020 17:53 36,096 Cpuid.efi > 12/22/2020 17:52 17,344 DumpDynPcd.efi > 12/22/2020 17:52 24,192 MemoryProfileInfo.efi > 12/22/2020 17:52 30,720 SmiHandlerProfileInfo.efi > 12/22/2020 17:52 10,880 VariableInfo.efi > 6 File(s) 224,768 bytes > 2 Dir(s) (2a) Before: > FS2:\> dir apps\*\*.efi > Directory of: FS2:\apps\*\ > 12/22/2020 17:52 18,752 DumpDynPcd.efi > 12/22/2020 17:52 34,240 SmiHandlerProfileInfo.efi > 12/22/2020 17:52 11,456 VariableInfo.efi > 12/22/2020 17:52 26,304 MemoryProfileInfo.efi > 12/22/2020 17:53 126,656 AcpiViewApp.efi > 12/22/2020 17:53 38,784 Cpuid.efi > 12/22/2020 17:52 32,768 DumpDynPcd.efi > 12/22/2020 17:52 20,480 VariableInfo.efi > 12/22/2020 17:52 40,960 MemoryProfileInfo.efi > 12/22/2020 17:53 139,264 AcpiViewApp.efi > 12/22/2020 17:52 17,344 DumpDynPcd.efi > 12/22/2020 17:52 30,720 SmiHandlerProfileInfo.efi > 12/22/2020 17:52 10,880 VariableInfo.efi > 12/22/2020 17:52 24,192 MemoryProfileInfo.efi > 12/22/2020 17:53 105,536 AcpiViewApp.efi > 12/22/2020 17:53 36,096 Cpuid.efi > 16 File(s) 714,432 bytes > 0 Dir(s) (2b) After: > FS2:\> dir apps\*\*.efi > Directory of: FS2:\apps\*\ > 12/22/2020 17:53 126,656 AcpiViewApp.efi > 12/22/2020 17:53 139,264 AcpiViewApp.efi > 12/22/2020 17:53 105,536 AcpiViewApp.efi > 12/22/2020 17:53 38,784 Cpuid.efi > 12/22/2020 17:53 36,096 Cpuid.efi > 12/22/2020 17:52 18,752 DumpDynPcd.efi > 12/22/2020 17:52 32,768 DumpDynPcd.efi > 12/22/2020 17:52 17,344 DumpDynPcd.efi > 12/22/2020 17:52 26,304 MemoryProfileInfo.efi > 12/22/2020 17:52 40,960 MemoryProfileInfo.efi > 12/22/2020 17:52 24,192 MemoryProfileInfo.efi > 12/22/2020 17:52 34,240 SmiHandlerProfileInfo.efi > 12/22/2020 17:52 30,720 SmiHandlerProfileInfo.efi > 12/22/2020 17:52 11,456 VariableInfo.efi > 12/22/2020 17:52 20,480 VariableInfo.efi > 12/22/2020 17:52 10,880 VariableInfo.efi > 16 File(s) 714,432 bytes > 0 Dir(s) (In example (2), note that the sorting is stable; that is, whatever order is established between identical FileNames by ShellOpenFileMetaArg(), it is preserved by ShellSortFileList().) Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3151 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Message-Id: <20210113085453.10168-8-lersek@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-08-19ShellPkg: Fix spelling mistake for occurredMichael D Kinney2-2/+2
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2361 Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Guomin Jiang <guomin.jiang@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
2020-06-18ShellPkg: Update timezone of 3 citiesDorapika Wu1-6/+6
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2780 The timezone of following cities should be updated: Istanbul: UTC+3 Novosibirsk: UTC+7 Georgetown (Guyana): UTC-4 Signed-off-by: Dorapika Wu <chuan-hsun.wu@hpe.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
2019-11-04ShellPkg/Ls: Return empty content for all empty foldersMarvin Haeuser1-5/+28
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2296 Currently, when 'ls' is run on an entirely empty directory (this includes not having '.' and '..'), the output is always 'File not found'. For when not filtering its children, this patch rather displays the usual header and footer. Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Marvin Haeuser <mhaeuser@outlook.de> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
2019-11-04ShellPkg/Ls: Consider UEFI timezone may not be setMarvin Haeuser1-1/+1
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> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
2019-10-09ShellPkg: stop taking EFI_HANDLE in place of SHELL_FILE_HANDLELaszlo Ersek1-1/+1
The TouchFileByHandle() and IsDirectoryEmpty() functions are passed SHELL_FILE_HANDLE parameters, and they use those parameters correctly. However, their parameter lists say EFI_HANDLE. Spell out the right type in the parameter lists. In practice, this change is a no-op (because, quite regrettably, both EFI_HANDLE and SHELL_FILE_HANDLE are specified to be typedefs of (VOID*)). Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
2019-10-09ShellPkg: stop using EFI_HANDLE in place of EFI_HII_HANDLELaszlo Ersek2-2/+2
The UefiShell*CommandsLib instances have constructor functions that do something like: gHiiHandle = HiiAddPackages (...); ... ShellCommandRegisterCommandName (..., gHiiHandle, ...); and destructor functions that implement the following pattern: HiiRemovePackages (gHiiHandle); The -- semantic, not functional -- problem is that "gHiiHandle" is declared with type EFI_HANDLE, and not EFI_HII_HANDLE, in all of these library instances, even though HiiAddPackages() correctly returns EFI_HII_HANDLE, and HiiRemovePackages() takes EFI_HII_HANDLE. Once we fix the type of "gHiiHandle", it causes sort of a butterfly effect, because it is passed around widely. Track down and update all of those locations. The DynamicCommand lib instances use a similar pattern, so they are affected too. NOTE: in practice, this patch is a no-op, as both EFI_HII_HANDLE and EFI_HANDLE are typedefs to (VOID*). However, we shouldn't use EFI_HANDLE where semantically EFI_HII_HANDLE is passed around. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
2019-09-25ShellPkg: Unload image on EFI_SECURITY_VIOLATIONDandan Bi1-1/+10
For the LoadImage() boot service, with EFI_SECURITY_VIOLATION retval, the Image was loaded and an ImageHandle was created with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now. This follows UEFI Spec. But if the caller of LoadImage() doesn't have the option to defer the execution of an image, we can not treat EFI_SECURITY_VIOLATION like any other LoadImage() error, we should unload image for the EFI_SECURITY_VIOLATION to avoid resource leak. This patch is to do error handling for EFI_SECURITY_VIOLATION explicitly for the callers in ShellPkg which don't have the policy to defer the execution of the image. Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Philippe Mathieu-Daude <philmd@redhat.com> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1992 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
2019-08-13ShellPkg/UefiShellLevel2CommansLib: Pointer Resonse should be checkedGao, Zhichao2-2/+8
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2049 ShellPkg\Library\UefiShellLevel2CommandsLib\Cp.c line 104 and ShellPkg\Library\UefiShellLevel2CommandsLib\Mv.c line 640, the pointer variable Response may be a NULL pointer. So we should make sure that it isn't NULL before dereference it. If Response is NULL that indicates a EFI_OUT_OF_RESOURCES error, directly return SHELL_ABORTED. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2019-04-09ShellPkg: Replace BSD License with BSD+Patent LicenseMichael D Kinney18-125/+18
https://bugzilla.tianocore.org/show_bug.cgi?id=1373 Replace BSD 2-Clause License with BSD+Patent License. This change is based on the following emails: https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html RFCs with detailed process for the license change: V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2018-10-12ShellPkg-Cd: Ensure all valid cd targets are handled properlyJim.Dailey@dell.com1-4/+4
ShellPkg-Cd: Ensure all valid cd targets are handled properly Make sure that PathCleanUpDirectories() is called on all valid targets of the cd command. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jim Dailey <jim_dailey@dell.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>