public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: devel@edk2.groups.io, zhichao.gao@intel.com
Cc: Ray Ni <ray.ni@intel.com>, Linson Augustine <linson.augustine@intel.com>
Subject: Re: [edk2-devel] [PATCH] ShellPkg/ShellProtocol: Return error code while fail parsing cmd-line
Date: Mon, 2 Dec 2019 11:20:39 +0100	[thread overview]
Message-ID: <6f2965c6-862a-e043-420a-9dceb17e63f9@redhat.com> (raw)
In-Reply-To: <20191202005348.22208-1-zhichao.gao@intel.com>

On 12/2/19 1:53 AM, Gao, Zhichao via Groups.Io wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2395
> 
> Errors happened in the arguments parsing is not a critical error.
> And it would miss the error status code in the release version of shell.
> So replace the ASSERT with returning error status code while fail
> parsing command-line in UpdateArgcArgv.
> 
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Linson Augustine <linson.augustine@intel.com>
> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
> ---
>   ShellPkg/Application/Shell/ShellProtocol.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c
> index 5e529b6568..f0362a42d8 100644
> --- a/ShellPkg/Application/Shell/ShellProtocol.c
> +++ b/ShellPkg/Application/Shell/ShellProtocol.c
> @@ -1497,7 +1497,10 @@ InternalShellExecuteDevicePath(
>       ShellParamsProtocol.StdOut  = ShellInfoObject.NewShellParametersProtocol->StdOut;
>       ShellParamsProtocol.StdErr  = ShellInfoObject.NewShellParametersProtocol->StdErr;
>       Status = UpdateArgcArgv(&ShellParamsProtocol, NewCmdLine, Efi_Application, NULL, NULL);
> -    ASSERT_EFI_ERROR(Status);
> +    if (EFI_ERROR (Status)) {

UpdateArgcArgv() is documented to only return EFI_OUT_OF_RESOURCES as 
error, however it calls ParseCommandLineToArgs() which - also not 
documented - returns EFI_INVALID_PARAMETER.
I suppose this is the "not critical" error this BZ is trying to catch.

Should we force Status to EFI_INVALID_PARAMETER before returning, is it 
safer to return EFI_OUT_OF_RESOURCES if it ever occurs? Should we assert 
if Status is EFI_OUT_OF_RESOURCES?

> +      goto UnloadImage;
> +    }
> +
>       //
>       // Replace Argv[0] with the full path of the binary we're executing:
>       // If the command line was "foo", the binary might be called "foo.efi".
> 


  parent reply	other threads:[~2019-12-02 10:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-02  0:53 [PATCH] ShellPkg/ShellProtocol: Return error code while fail parsing cmd-line Gao, Zhichao
2019-12-02  3:38 ` Augustine, Linson
2019-12-02 10:20 ` Philippe Mathieu-Daudé [this message]
2019-12-02 11:04   ` [edk2-devel] " Gao, Zhichao
2019-12-02 11:09     ` Philippe Mathieu-Daudé
2019-12-12  5:44       ` Gao, Zhichao
2019-12-12  7:26 ` Ni, Ray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6f2965c6-862a-e043-420a-9dceb17e63f9@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox