From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=68.232.153.95; helo=esa5.dell-outbound.iphmx.com; envelope-from=jim.dailey@dell.com; receiver=edk2-devel@lists.01.org Received: from esa5.dell-outbound.iphmx.com (esa5.dell-outbound.iphmx.com [68.232.153.95]) (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 BD31B210DA7A8 for ; Tue, 7 Aug 2018 11:29:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dell.com; i=@dell.com; q=dns/txt; s=smtpout; t=1533666572; x=1565202572; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=rH3U7klDfrOozcyycu9e7FHkTnfO9h6kn+KB4+pZg8s=; b=j/auh1/nSy06SRcPesb0Uvb6ZWLNQ9M07O6LRd2Ov+q8unX+yN9hhQB9 uTr1OoPg1fiGNHqhl42jBZ1MhpbQOoKQ6QkL3jwz0SSH8ar2HtBTROA0y uie846MOXAjSJPbZUYEOAYZCwNc9FYmKt6gQ0nzsqsKFgrUR6RQkDDwxk 8=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2FKAADY42lbhyWd50NbGgEBAQEBAgE?= =?us-ascii?q?BAQEIAQEBAYQxfygKi39fi2iCDZVtgXoLGAuESQKDRCE0GAECAQECAQECAQE?= =?us-ascii?q?CEAEBAQoLCQgpIwyCNSKBRSwNYwEBAQQBERUTPwwEAgEIEQQBAR8JBygeCQg?= =?us-ascii?q?CBA4FCBqCfgGBfw+iVYlXAQEBgWgzikoFgi2GYoIXg3YugxsEGIcdAod8hHi?= =?us-ascii?q?NRQcChhuFO4NpgVeHF4VBim+EZYJpAgQCBAUCFIFBggtwgzmCM4g3K4U+bwG?= =?us-ascii?q?NS4EbAQE?= X-IPAS-Result: =?us-ascii?q?A2FKAADY42lbhyWd50NbGgEBAQEBAgEBAQEIAQEBAYQxf?= =?us-ascii?q?ygKi39fi2iCDZVtgXoLGAuESQKDRCE0GAECAQECAQECAQECEAEBAQoLCQgpI?= =?us-ascii?q?wyCNSKBRSwNYwEBAQQBERUTPwwEAgEIEQQBAR8JBygeCQgCBA4FCBqCfgGBf?= =?us-ascii?q?w+iVYlXAQEBgWgzikoFgi2GYoIXg3YugxsEGIcdAod8hHiNRQcChhuFO4Npg?= =?us-ascii?q?VeHF4VBim+EZYJpAgQCBAUCFIFBggtwgzmCM4g3K4U+bwGNS4EbAQE?= Received: from mx0b-00154901.pphosted.com ([67.231.157.37]) by esa5.dell-outbound.iphmx.com with ESMTP/TLS/AES256-SHA256; 07 Aug 2018 13:29:30 -0500 Received: from pps.filterd (m0144104.ppops.net [127.0.0.1]) by mx0b-00154901.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w77IRlr7004121 for ; Tue, 7 Aug 2018 14:29:47 -0400 Received: from esa4.dell-outbound2.iphmx.com (esa4.dell-outbound2.iphmx.com [68.232.154.98]) by mx0b-00154901.pphosted.com with ESMTP id 2kqcujhfdc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 07 Aug 2018 14:29:47 -0400 From: Received: from ausxipps306.us.dell.com ([143.166.148.156]) by esa4.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA256; 08 Aug 2018 00:29:46 +0600 X-LoopCount0: from 10.166.136.211 X-IronPort-AV: E=Sophos;i="5.51,456,1526360400"; d="scan'208";a="232431758" To: CC: , Thread-Topic: [PATCH] ShellPkg/set: Fix EfiShellSetEnv to use case sensitive compare Thread-Index: AQHULi8CauDrpksFZ0uvoU/8vPYecKS0k8kggAAHp+A= Date: Tue, 7 Aug 2018 18:27:13 +0000 Message-ID: <1a93054aa36c45788250727380c51034@ausx13mps335.AMER.DELL.COM> References: <20180807091401.48840-1-ruiyu.ni@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Enabled=True; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_SiteId=945c199a-83a2-4e80-9f8c-5a91be5752dd; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Owner=Jim_Dailey@Dell.com; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_SetDate=2018-08-07T18:26:56.0185162Z; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Name=External Public; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Application=Microsoft Azure Information Protection; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Extended_MSFT_Method=Manual; Sensitivity=External Public x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.143.18.86] MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-08-07_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=945 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808070185 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: Tue, 07 Aug 2018 18:29:51 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ray, Table 8 in version 2.2 of the Shell Spec says "lasterror" (lower-case L). = Why compare to "Lasterror"? Regards, Jim -----Original Message----- From: Carsey, Jaben [mailto:jaben.carsey@intel.com]=20 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 sensitive= compare Reviewed-by: Jaben Carsey > -----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 >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D777 >=20 > 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. >=20 > The patch fixes this issue. >=20 > The EfiShellGetEnv() doesn't have such issue because it will > call into ShellFindEnvVarInList() which uses StrCmp(). >=20 > 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(-) >=20 > 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