Jaben, Is there any generic EFI-to-Shell status conversion routine/macro? If no, as Eugene has declared the below patch is a temporary patch and can't give the useful returned status, a formal patch is required to fix this issue.
Thanks. Jiaxin -----Original Message----- From: edk2-devel [mailto:[email protected]] On Behalf Of Cohen, Eugene Sent: Tuesday, November 24, 2015 10:38 PM To: [email protected]; Carsey, Jaben Subject: [edk2] [PATCH] ShellPkg: Wrong return status for Ifconfig.c The Ifconfig command handler tries to return an EFI_STATUS when the return type should be SHELL_STATUS. RVCT 4 is (correctly) flagging this as an error: edk2\ShellPkg\Library\UefiShellNetwork1CommandsLib\Ifconfig.c(1387,10): error #188-D: enumerated type mixed with another type I haven't found a pattern to convert EFI_STATUS to SHELL_STATUS that works well - the examples I've seen seem to lump all EFI_STATUS errors into a single shell error like "if(EFI_ERROR(Status)) ShellStatus = SHELL_INVALID_PARAMETER" resulting in loss of useful information. I was hoping there would be a generic EFI-to-Shell status conversion routine/macro that could help do this. Here's a crummy temporary patch to convert the return status. -- f281fca920f1bb33b2c15cb498a8889bbe9ff035 edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c b/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c index e16d46a..609c535 100644 --- a/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c +++ b/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c @@ -1384,5 +1384,9 @@ ON_EXIT: IfConfigCleanup (Private); } - return Status; + if (EFI_ERROR(Status)) { + return SHELL_ABORTED; + } else { + return SHELL_SUCCESS; + } } -- Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eugene Cohen < [email protected]> Eugene _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

