From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 3ED0520348637 for ; Tue, 7 Aug 2018 22:03:24 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Aug 2018 22:03:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,456,1526367600"; d="scan'208";a="79476427" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga001.fm.intel.com with ESMTP; 07 Aug 2018 22:03:23 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 7 Aug 2018 22:03:23 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 7 Aug 2018 22:03:22 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.143]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.240]) with mapi id 14.03.0319.002; Wed, 8 Aug 2018 13:03:20 +0800 From: "Ni, Ruiyu" To: "Jim.Dailey@dell.com" CC: "Carsey, Jaben" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH] ShellPkg/set: Fix EfiShellSetEnv to use case sensitive compare Thread-Index: AQHULngXS72erldui0Gt1fdNFNhTP6S0FXiAgAE39RA= Date: Wed, 8 Aug 2018 05:03:19 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BDC412F@SHSMSX104.ccr.corp.intel.com> References: <20180807091401.48840-1-ruiyu.ni@intel.com> <1a93054aa36c45788250727380c51034@ausx13mps335.AMER.DELL.COM> In-Reply-To: <1a93054aa36c45788250727380c51034@ausx13mps335.AMER.DELL.COM> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] ShellPkg/set: Fix EfiShellSetEnv to use case sensitive compare X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Aug 2018 05:03:24 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable It's a typo. V2 patch will correct this. Thanks/Ray > -----Original Message----- > From: edk2-devel On Behalf Of > Jim.Dailey@dell.com > Sent: Wednesday, August 8, 2018 2:27 AM > To: Ni, Ruiyu > Cc: Carsey, Jaben ; edk2-devel@lists.01.org > Subject: Re: [edk2] [PATCH] ShellPkg/set: Fix EfiShellSetEnv to use case > sensitive compare >=20 > Ray, >=20 > Table 8 in version 2.2 of the Shell Spec says "lasterror" (lower-case L).= Why > compare to "Lasterror"? >=20 > Regards, > Jim >=20 > -----Original Message----- > From: Carsey, Jaben [mailto:jaben.carsey@intel.com] > Sent: Tuesday, August 7, 2018 12:57 PM > To: Ni, Ruiyu; edk2-devel@lists.01.org > Cc: Dailey, Jim > Subject: RE: [PATCH] ShellPkg/set: Fix EfiShellSetEnv to use case sensiti= ve > compare >=20 > Reviewed-by: Jaben Carsey >=20 > > -----Original Message----- > > From: Ni, Ruiyu > > Sent: Tuesday, August 07, 2018 2:14 AM > > To: edk2-devel@lists.01.org > > Cc: Carsey, Jaben ; Jim Dailey > > > > Subject: [PATCH] ShellPkg/set: Fix EfiShellSetEnv to use case > > sensitive compare > > Importance: High > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D777 > > > > Per Shell spec, the environment variable has a case-sensitive name. > > But today's implementation of EfiShellSetEnv() compares the > > environment variable name case insensitively, which causes variable > > like "CWD" cannot be set due to "cwd" is pre-defined variable. > > > > The patch fixes this issue. > > > > The EfiShellGetEnv() doesn't have such issue because it will call into > > ShellFindEnvVarInList() which uses StrCmp(). > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Ruiyu Ni > > Cc: Jaben Carsey > > Cc: Jim Dailey > > --- > > ShellPkg/Application/Shell/ShellProtocol.c | 39 > > +++++++----------------------- > > 1 file changed, 9 insertions(+), 30 deletions(-) > > > > diff --git a/ShellPkg/Application/Shell/ShellProtocol.c > > b/ShellPkg/Application/Shell/ShellProtocol.c > > index f2ca2029e3..767cbc99a0 100644 > > --- a/ShellPkg/Application/Shell/ShellProtocol.c > > +++ b/ShellPkg/Application/Shell/ShellProtocol.c > > @@ -2924,36 +2924,15 @@ EfiShellSetEnv( > > // > > // Make sure we dont 'set' a predefined read only variable > > // > > - if (gUnicodeCollation->StriColl( > > - gUnicodeCollation, > > - (CHAR16*)Name, > > - L"cwd") =3D=3D 0 > > - ||gUnicodeCollation->StriColl( > > - gUnicodeCollation, > > - (CHAR16*)Name, > > - L"Lasterror") =3D=3D 0 > > - ||gUnicodeCollation->StriColl( > > - gUnicodeCollation, > > - (CHAR16*)Name, > > - L"profiles") =3D=3D 0 > > - ||gUnicodeCollation->StriColl( > > - gUnicodeCollation, > > - (CHAR16*)Name, > > - L"uefishellsupport") =3D=3D 0 > > - ||gUnicodeCollation->StriColl( > > - gUnicodeCollation, > > - (CHAR16*)Name, > > - L"uefishellversion") =3D=3D 0 > > - ||gUnicodeCollation->StriColl( > > - gUnicodeCollation, > > - (CHAR16*)Name, > > - L"uefiversion") =3D=3D 0 > > - ||(!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest && > > - gUnicodeCollation->StriColl( > > - gUnicodeCollation, > > - (CHAR16*)Name, > > - (CHAR16*)mNoNestingEnvVarName) =3D=3D 0) > > - ){ > > + if ((StrCmp (Name, L"cwd") =3D=3D 0) || > > + (StrCmp (Name, L"Lasterror") =3D=3D 0) || > > + (StrCmp (Name, L"profiles") =3D=3D 0) || > > + (StrCmp (Name, L"uefishellsupport") =3D=3D 0) || > > + (StrCmp (Name, L"uefishellversion") =3D=3D 0) || > > + (StrCmp (Name, L"uefiversion") =3D=3D 0) || > > + (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest && > > + StrCmp (Name, mNoNestingEnvVarName) =3D=3D 0) > > + ) { > > return (EFI_INVALID_PARAMETER); > > } > > return (InternalEfiShellSetEnv(Name, Value, Volatile)); > > -- > > 2.16.1.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel