public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Zhichao" <zhichao.gao@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Ni, Ray" <ray.ni@intel.com>, "jwatt@jwatt.org" <jwatt@jwatt.org>
Cc: "Carsey, Jaben" <jaben.carsey@intel.com>,
	"Bi, Dandan" <dandan.bi@intel.com>
Subject: Re: [edk2-devel] [PATCH v1 1/1] ShellPkg/UefiShellBcfgCommandLib: Fix '-opt' option
Date: Tue, 7 May 2019 09:51:35 +0000	[thread overview]
Message-ID: <3CE959C139B4C44DBEA1810E3AA6F9000B7D0C0D@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5C12C3EF@SHSMSX104.ccr.corp.intel.com>

This patch looks good for me.
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>

But when I view the command in UEFI SHELL 2.2 spec:
...
bcfg driver|boot [-opt # [[filename]|["data"]] | [KeyData <ScanCode UnicodeChar>*]]
...
-opt
Modify the optional data associated with a driver or boot option. Followed either by the filename of the file which contains the binary data to be associated with the driver or boot option optional data, or else the quote-delimited data that will be associated with the driver or boot option optional data.
...

This description lack the comment of '#' parameter and that may make the consumer confused. Usually consumers would regard it as the same in other option, such as ' bcfg driver|boot [rm #]'. The '#' is clearly descripted as a hexadecimal parameter:
rm
Remove an option. The # parameter lists the option number to remove in hexadecimal.

So I think we should update the shell spec by the way.

Thanks,
Zhichao

> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Ni,
> Ray
> Sent: Monday, May 6, 2019 10:02 PM
> To: jwatt@jwatt.org; devel@edk2.groups.io
> Cc: Carsey, Jaben <jaben.carsey@intel.com>; Bi, Dandan
> <dandan.bi@intel.com>
> Subject: Re: [edk2-devel] [PATCH v1 1/1] ShellPkg/UefiShellBcfgCommandLib:
> Fix '-opt' option
> 
> Dandan,
> Can you please help to review?
> 
> Thanks,
> Ray
> 
> > -----Original Message-----
> > From: jwatt@jwatt.org [mailto:jwatt@jwatt.org]
> > Sent: Monday, May 6, 2019 9:03 PM
> > To: devel@edk2.groups.io
> > Cc: Carsey, Jaben <jaben.carsey@intel.com>; Ni, Ray <ray.ni@intel.com>
> > Subject: [PATCH v1 1/1] ShellPkg/UefiShellBcfgCommandLib: Fix '-opt'
> > option
> >
> > From: Jonathan Watt <jwatt@jwatt.org>
> >
> > For all other bcfg commands the "#" (option number) argument(s) are
> > treated as hexedecimal values regardless of whether or not they are
> > prefixed by "0x".  This change fixes '-opt' to handle its "#"
> > (option number) argument consistently with the other commands.
> >
> > Making this change removes a potential footgun whereby a user that has
> > been using a number without a "0x" prefix with other bcfg commands
> > finds that, on using that exact same number with '-opt', it has this
> > time unexpectedly been interpreted as a decimal number and they have
> > modified
> > (corrupted) an unrelated load option.  For example, a user may have
> > been specifying "10" to other commands to have them act on the 16th
> > option (because simply "10", without any prefix, is how 'bcfg boot
> > dump' displayed the option number for the 16th option). Unfortunately
> > for them, if they also use '-opt' with "10" it would unexpectedly and
> > inconsistently act on the 10th option.
> >
> > CC: Jaben Carsey <jaben.carsey@intel.com>
> > CC: Ray Ni <ray.ni@intel.com>
> > Signed-off-by: Jonathan Watt <jwatt@jwatt.org>
> > ---
> >  ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c |
> > 2
> > +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git
> > a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
> > b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
> > index d033c7c1dc59..e8b48b4990dd 100644
> > ---
> > a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
> > +++
> > b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
> > @@ -1019,7 +1019,7 @@ BcfgAddOpt(
> >    //
> >    // Get the index of the variable we are changing.
> >    //
> > -  Status = ShellConvertStringToUint64(Walker, &Intermediate, FALSE,
> > TRUE);
> > +  Status = ShellConvertStringToUint64(Walker, &Intermediate, TRUE,
> > + TRUE);
> >    if (EFI_ERROR(Status) || (((UINT16)Intermediate) != Intermediate)
> > || StrStr(Walker, L" ") == NULL || ((UINT16)Intermediate) >
> > ((UINT16)OrderCount)) {
> >      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
> > gShellBcfgHiiHandle, L"bcfg", L"Option Index");
> >      ShellStatus = SHELL_INVALID_PARAMETER;
> > --
> > 2.21.0
> 
> 
> 


  reply	other threads:[~2019-05-07  9:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-06 13:02 [PATCH v1 0/1] ShellPkg/UefiShellBcfgCommandLib: Fix '-opt' option number handling Jonathan Watt
2019-05-06 13:02 ` [PATCH v1 1/1] ShellPkg/UefiShellBcfgCommandLib: Fix '-opt' option Jonathan Watt
2019-05-06 14:02   ` Ni, Ray
2019-05-07  9:51     ` Gao, Zhichao [this message]
2019-05-07 14:35       ` [edk2-devel] " Carsey, Jaben
2019-05-07 15:05         ` Dandan Bi
2019-05-07 16:20         ` Tim Lewis
2019-05-07 17:40           ` Carsey, Jaben
2019-05-07 17:43             ` Tim Lewis
2019-05-07 19:00             ` Jonathan Watt
2019-05-07 19:06               ` Jonathan Watt
2019-05-07 20:04                 ` Tim Lewis
2019-05-07 20:30                   ` Jim.Dailey
2019-05-07 20:48                     ` Tim Lewis
2019-05-07 20:52                       ` Jim.Dailey
2019-05-07 21:04                       ` Jonathan Watt
2019-05-07 20:51                   ` Jonathan Watt
2019-05-07 21:02                     ` Tim Lewis
2019-05-07 21:07                       ` Jonathan Watt
2019-05-07 23:59                         ` Carsey, Jaben
2019-05-08  0:08                           ` Tim Lewis
2019-06-11 21:53                             ` Jonathan Watt
     [not found]                             ` <15A74385D3E8CBEB.24554@groups.io>
2019-08-02 20:28                               ` Jonathan Watt
2019-08-02 21:23                                 ` Carsey, Jaben
2019-08-05  0:51                                   ` Gao, Zhichao
2019-08-12 16:31                                     ` Jonathan Watt

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=3CE959C139B4C44DBEA1810E3AA6F9000B7D0C0D@SHSMSX101.ccr.corp.intel.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