From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from g2t2354.austin.hpe.com (g2t2354.austin.hpe.com [15.233.44.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2936B21A16EFF for ; Mon, 5 Jun 2017 08:24:03 -0700 (PDT) Received: from G2W6311.americas.hpqcorp.net (g2w6311.austin.hp.com [16.197.64.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g2t2354.austin.hpe.com (Postfix) with ESMTPS id 668228A for ; Mon, 5 Jun 2017 15:25:08 +0000 (UTC) Received: from G9W4615.americas.hpqcorp.net (16.220.56.56) by G2W6311.americas.hpqcorp.net (16.197.64.53) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Mon, 5 Jun 2017 15:25:08 +0000 Received: from G4W10205.americas.hpqcorp.net (2002:10cf:520f::10cf:520f) by G9W4615.americas.hpqcorp.net (2002:10dc:3838::10dc:3838) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Mon, 5 Jun 2017 15:25:08 +0000 Received: from NAM01-SN1-obe.outbound.protection.outlook.com (15.241.52.13) by G4W10205.americas.hpqcorp.net (16.207.82.15) with Microsoft SMTP Server (TLS) id 15.0.1178.4 via Frontend Transport; Mon, 5 Jun 2017 15:25:07 +0000 Received: from CS1PR84MB0024.NAMPRD84.PROD.OUTLOOK.COM (10.162.189.142) by CS1PR84MB0022.NAMPRD84.PROD.OUTLOOK.COM (10.162.189.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10; Mon, 5 Jun 2017 15:25:05 +0000 Received: from CS1PR84MB0024.NAMPRD84.PROD.OUTLOOK.COM ([10.162.189.142]) by CS1PR84MB0024.NAMPRD84.PROD.OUTLOOK.COM ([10.162.189.142]) with mapi id 15.01.1143.019; Mon, 5 Jun 2017 15:25:05 +0000 From: "Shah, Tapan" To: "Ni, Ruiyu" , "Carsey, Jaben" , "edk2-devel@lists.01.org" CC: "Kinney, Michael D" Thread-Topic: [PATCH] ShellPkg/alias: Fix bug to support upper-case alias Thread-Index: AQHS2ugM1wn+O0paRkq5clEErBSxY6IQGazggAB6rQD//4/SIIAAAP/wgAC10oCAANIhAIAAEtsQgAIikYCAAodH0A== Date: Mon, 5 Jun 2017 15:25:05 +0000 Message-ID: References: <20170601141136.145340-1-ruiyu.ni@intel.com> <734D49CCEBEEF84792F5B80ED585239D5B982065@SHSMSX104.ccr.corp.intel.com> <734D49CCEBEEF84792F5B80ED585239D5B982AEF@SHSMSX104.ccr.corp.intel.com> <734D49CCEBEEF84792F5B80ED585239D5B9862D6@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5B9862D6@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=hpe.com; x-originating-ip: [15.203.227.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CS1PR84MB0022; 7:CLG5uzBF5jrXqjz+tGSG6bgiBYUiWJNtLkzxAuwwz3xFbQE7113Qpx0QutTPaPPN0P4so61KRtSPKwvnEvbeseLzYJNHZflRF9ha1ezUa3cYWh+iVmtbkAldh0m0Ih3wjjLdGcI76e9A5xoRMnSw0HYFFGm2rN2qFBQz2DWt5efyk8aOOcdMFKNpkgZ+Wwx3n7FOw8RDmeCFOdhjuEPlqgM/3KF6DN1jDlZlY7FOH+Ipi8meN3Q7uKNjg3vV5RiAcpNKKYufTEIOcAdcb4qxM3tVchdAc0qcW+6OGOrLel5ap5QgOW8EJaB7Na3Dx3W+/D37tLJG0O2PmYpfeEXUvA== x-ms-traffictypediagnostic: CS1PR84MB0022: x-ms-office365-filtering-correlation-id: 439b0162-a5a7-46ef-ed1d-08d4ac270b54 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081)(201702281549075); SRVR:CS1PR84MB0022; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(788757137089)(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6041248)(20161123555025)(20161123558100)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CS1PR84MB0022; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CS1PR84MB0022; x-forefront-prvs: 0329B15C8A x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39840400002)(39860400002)(39400400002)(39410400002)(39450400003)(39850400002)(377454003)(13464003)(51444003)(3660700001)(14454004)(966005)(77096006)(2906002)(3280700002)(66066001)(478600001)(2501003)(7696004)(229853002)(6506006)(81166006)(8936002)(25786009)(53546009)(8676002)(2900100001)(6436002)(6116002)(86362001)(2950100002)(102836003)(93886004)(189998001)(575784001)(5660300001)(76176999)(50986999)(3846002)(54356999)(55016002)(33656002)(7736002)(6306002)(53936002)(122556002)(9686003)(305945005)(74316002)(38730400002)(4326008); DIR:OUT; SFP:1102; SCL:1; SRVR:CS1PR84MB0022; H:CS1PR84MB0024.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; MLV:sfv; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jun 2017 15:25:05.8180 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR84MB0022 X-OriginatorOrg: hpe.com Subject: Re: [PATCH] ShellPkg/alias: Fix bug to support upper-case alias X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jun 2017 15:24:03 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable It's a bug and should be fixed. Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=3D589 Thanks, Tapan -----Original Message----- From: Ni, Ruiyu [mailto:ruiyu.ni@intel.com]=20 Sent: Saturday, June 03, 2017 7:48 PM To: Shah, Tapan ; Carsey, Jaben ; edk2-devel@lists.01.org Cc: Kinney, Michael D Subject: RE: [PATCH] ShellPkg/alias: Fix bug to support upper-case alias It's the original behavior of alias, not changed by this fix. If you think it's a bug, could you please submit a Bugzilla to record it? Regards, Ray >-----Original Message----- >From: Shah, Tapan [mailto:tapandshah@hpe.com] >Sent: Saturday, June 3, 2017 12:13 AM >To: Carsey, Jaben ; Ni, Ruiyu=20 >; edk2-devel@lists.01.org >Cc: Kinney, Michael D >Subject: RE: [PATCH] ShellPkg/alias: Fix bug to support upper-case=20 >alias > >When attempting to delete an alias that does not exist, it does not=20 >return an error in lasterror status indiciating alias was not found. > >-----Original Message----- >From: Carsey, Jaben [mailto:jaben.carsey@intel.com] >Sent: Friday, June 02, 2017 10:04 AM >To: Ni, Ruiyu ; edk2-devel@lists.01.org >Cc: Kinney, Michael D ; Shah, Tapan=20 > >Subject: RE: [PATCH] ShellPkg/alias: Fix bug to support upper-case=20 >alias > >Ok. I see now. Thanks! > >Reviewed-by: Jaben Carsey > >> -----Original Message----- >> From: Ni, Ruiyu >> Sent: Thursday, June 01, 2017 7:32 PM >> To: Carsey, Jaben ; edk2-devel@lists.01.org >> Cc: Kinney, Michael D ; Shah, Tapan >> (tapandshah@hpe.com) >> Subject: RE: [PATCH] ShellPkg/alias: Fix bug to support upper-case=20 >> alias >> Importance: High >> >> Jaben, >> Old code also honors the returning status when delete an alias. >> Please check the line I marked as "<----------" in below. >> >> // >> // We must be trying to remove one if Alias is NULL >> // >> if (Alias =3D=3D NULL) { >> // >> // remove an alias (but passed in COMMAND parameter) >> // >> Status =3D (gRT->SetVariable((CHAR16*)Command, &gShellAliasGuid, 0,= =20 >> 0, NULL)); // <------------------ >> } else { >> // >> // Add and replace are the same >> // >> >> // We dont check the error return on purpose since the variable=20 >> may not exist. >> gRT->SetVariable((CHAR16*)Command, &gShellAliasGuid, 0, 0, NULL); >> >> Status =3D (gRT->SetVariable((CHAR16*)Alias, &gShellAliasGuid,=20 >> EFI_VARIABLE_BOOTSERVICE_ACCESS|(Volatile?0:EFI_VARIABLE_NON_VOL >> ATILE), StrSize(Command), (VOID*)Command)); >> } >> >> Regards, >> Ray >> >> >-----Original Message----- >> >From: Carsey, Jaben >> >Sent: Thursday, June 1, 2017 11:42 PM >> >To: Ni, Ruiyu ; edk2-devel@lists.01.org >> >Cc: Kinney, Michael D ; Shah, Tapan >> (tapandshah@hpe.com) >> >Subject: RE: [PATCH] ShellPkg/alias: Fix bug to support upper-case=20 >> >alias >> > >> >I think we have to leave the behavior the same. The spec says this: >> >" If the >> environment variable does not exist and the >> >Value is an empty string, there is no action." >> > >> >I do not think we can change that to an error return without a spec cha= nge. >> > >> >-Jaben >> > >> >> -----Original Message----- >> >> From: Carsey, Jaben >> >> Sent: Thursday, June 01, 2017 8:40 AM >> >> To: Ni, Ruiyu ; edk2-devel@lists.01.org >> >> Cc: Kinney, Michael D ; Shah, Tapan >> >> (tapandshah@hpe.com) >> >> Subject: RE: [PATCH] ShellPkg/alias: Fix bug to support upper-case=20 >> >> alias >> >> >> >> I just think we may want to have the behavior act the same as it=20 >> >> does >> today >> >> for delete. >> >> >> >> > -----Original Message----- >> >> > From: Ni, Ruiyu >> >> > Sent: Thursday, June 01, 2017 8:19 AM >> >> > To: Carsey, Jaben ;=20 >> >> > edk2-devel@lists.01.org >> >> > Cc: Kinney, Michael D ; Shah, Tapan >> >> > (tapandshah@hpe.com) >> >> > Subject: RE: [PATCH] ShellPkg/alias: Fix bug to support=20 >> >> > upper-case alias >> >> > Importance: High >> >> > >> >> > I was using AliasLower. >> >> > I am not sure whether the change is smallest. But I tried best=20 >> >> > to make >> the >> >> > new implementation cleaner. I think that's what we really need. >> >> > >> >> > Did you see any issue if we return EFI_NOT_FOUND (when variable >> doesn't >> >> > exist)? >> >> > >> >> > Regards, >> >> > Ray >> >> > >> >> > >-----Original Message----- >> >> > >From: Carsey, Jaben >> >> > >Sent: Thursday, June 1, 2017 11:02 PM >> >> > >To: Ni, Ruiyu ; edk2-devel@lists.01.org >> >> > >Cc: Kinney, Michael D ; Shah, Tapan >> >> > (tapandshah@hpe.com) >> >> > >Subject: RE: [PATCH] ShellPkg/alias: Fix bug to support=20 >> >> > >upper-case alias >> >> > > >> >> > >Why not just use the AliasLower and make the overall change=20 >> >> > >much >> >> > smaller? Looks like the old version did the conversion, >> >> > >but didn't use the result. >> >> > > >> >> > >Also, I notice that we are now checking the return value upon=20 >> >> > >delete, >> >> which >> >> > was explicitly not done in the old version. >> >> > >There was this comment before: "We dont check the error return=20 >> >> > >on >> >> > purpose since the variable may not exist." >> >> > > >> >> > >-Jaben >> >> > > >> >> > > >> >> > >> -----Original Message----- >> >> > >> From: Ni, Ruiyu >> >> > >> Sent: Thursday, June 01, 2017 7:12 AM >> >> > >> To: edk2-devel@lists.01.org >> >> > >> Cc: Carsey, Jaben ; Kinney, Michael D=20 >> >> > >> >> >> > >> Subject: [PATCH] ShellPkg/alias: Fix bug to support=20 >> >> > >> upper-case alias >> >> > >> Importance: High >> >> > >> >> >> > >> alias in UEFI Shell is case insensitive. >> >> > >> Old code saves the alias to variable storage without=20 >> >> > >> converting the alias to lower-case, which results upper case=20 >> >> > >> alias setting doesn't work. >> >> > >> The patch converts the alias to lower case before saving to=20 >> >> > >> variable storage. >> >> > >> >> >> > >> Contributed-under: TianoCore Contribution Agreement 1.0 >> >> > >> Signed-off-by: Ruiyu Ni >> >> > >> Cc: Jaben Carsey >> >> > >> Cc: Michael D Kinney >> >> > >> --- >> >> > >> ShellPkg/Application/Shell/ShellProtocol.c | 50 >> >> > >> +++++++++++++++-- >> ---- >> >> -- >> >> > ---- >> >> > >> --- >> >> > >> 1 file changed, 25 insertions(+), 25 deletions(-) >> >> > >> >> >> > >> diff --git a/ShellPkg/Application/Shell/ShellProtocol.c >> >> > >> b/ShellPkg/Application/Shell/ShellProtocol.c >> >> > >> index 347e162e62..b3b8acc0d0 100644 >> >> > >> --- a/ShellPkg/Application/Shell/ShellProtocol.c >> >> > >> +++ b/ShellPkg/Application/Shell/ShellProtocol.c >> >> > >> @@ -3463,40 +3463,40 @@ InternalSetAlias( { >> >> > >> EFI_STATUS Status; >> >> > >> CHAR16 *AliasLower; >> >> > >> + BOOLEAN DeleteAlias; >> >> > >> >> >> > >> - // Convert to lowercase to make aliases case-insensitive >> >> > >> - if (Alias !=3D NULL) { >> >> > >> - AliasLower =3D AllocateCopyPool (StrSize (Alias), Alias); >> >> > >> - if (AliasLower =3D=3D NULL) { >> >> > >> - return EFI_OUT_OF_RESOURCES; >> >> > >> - } >> >> > >> - ToLower (AliasLower); >> >> > >> - } else { >> >> > >> - AliasLower =3D NULL; >> >> > >> - } >> >> > >> - >> >> > >> - // >> >> > >> - // We must be trying to remove one if Alias is NULL >> >> > >> - // >> >> > >> + DeleteAlias =3D FALSE; >> >> > >> if (Alias =3D=3D NULL) { >> >> > >> // >> >> > >> + // We must be trying to remove one if Alias is NULL >> >> > >> // remove an alias (but passed in COMMAND parameter) >> >> > >> // >> >> > >> - Status =3D (gRT->SetVariable((CHAR16*)Command, >> &gShellAliasGuid, >> >> 0, >> >> > 0, >> >> > >> NULL)); >> >> > >> - } else { >> >> > >> - // >> >> > >> - // Add and replace are the same >> >> > >> - // >> >> > >> - >> >> > >> - // We dont check the error return on purpose since the vari= able >> may >> >> > not >> >> > >> exist. >> >> > >> - gRT->SetVariable((CHAR16*)Command, &gShellAliasGuid, 0, 0, >> >> NULL); >> >> > >> + Alias =3D Command; >> >> > >> + DeleteAlias =3D TRUE; >> >> > >> + } >> >> > >> + ASSERT (Alias !=3D NULL); >> >> > >> >> >> > >> - Status =3D (gRT->SetVariable((CHAR16*)Alias, &gShellAliasGu= id, >> >> > >> >> >> > >> >> >> EFI_VARIABLE_BOOTSERVICE_ACCESS|(Volatile?0:EFI_VARIABLE_NON_VOL >> >> > >> ATILE), StrSize(Command), (VOID*)Command)); >> >> > >> + // >> >> > >> + // Convert to lowercase to make aliases case-insensitive =20 >> >> > >> + // AliasLower =3D AllocateCopyPool (StrSize (Alias), Alias); = =20 >> >> > >> + if (AliasLower =3D=3D NULL) { >> >> > >> + return EFI_OUT_OF_RESOURCES; >> >> > >> } >> >> > >> + ToLower (AliasLower); >> >> > >> >> >> > >> - if (Alias !=3D NULL) { >> >> > >> - FreePool (AliasLower); >> >> > >> + if (DeleteAlias) { >> >> > >> + Status =3D gRT->SetVariable (AliasLower, &gShellAliasGuid,= =20 >> >> > >> + 0, 0, >> NULL); >> >> > >> + } else { >> >> > >> + Status =3D gRT->SetVariable ( >> >> > >> + AliasLower, &gShellAliasGuid, >> >> > >> + EFI_VARIABLE_BOOTSERVICE_ACCESS | (Volatile= ? 0 : >> >> > >> EFI_VARIABLE_NON_VOLATILE), >> >> > >> + StrSize (Command), (VOID *) Command >> >> > >> + ); >> >> > >> } >> >> > >> + >> >> > >> + FreePool (AliasLower); >> >> > >> + >> >> > >> return Status; >> >> > >> } >> >> > >> >> >> > >> -- >> >> > >> 2.12.2.windows.2 >