From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=15.73.212.82; helo=g2t4619.austin.hp.com; envelope-from=zheng.zhang1@hp.com; receiver=edk2-devel@lists.01.org Received: from g2t4619.austin.hp.com (g2t4619.austin.hp.com [15.73.212.82]) (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 7B79821ED1C6E for ; Thu, 8 Mar 2018 00:01:17 -0800 (PST) Received: from ZHANZHEN12.auth.hpicorp.net (zhanzhen12.auth.hpicorp.net [15.45.230.118]) by g2t4619.austin.hp.com (Postfix) with ESMTP id 11E7216B; Thu, 8 Mar 2018 08:07:28 +0000 (UTC) From: Zane Zhange To: edk2-devel@lists.01.org Cc: Jaben Carsey , Ruiyu Ni Date: Thu, 8 Mar 2018 16:07:27 +0800 Message-Id: <20180308080727.15328-1-zheng.zhang1@hp.com> X-Mailer: git-send-email 2.16.2.windows.1 X-Mailman-Approved-At: Thu, 08 Mar 2018 01:45:30 -0800 Subject: [BugFix] ShellPkg: UefiShellLevel1CommandLib: Fix a logic issue about "if /i" X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Mar 2018 08:01:19 -0000 From: zane66 Hello All, It is my first time to commit my change on github, there might be some errors in this email. But my change actually fixed the issue about "if /i" in Uefi Shell. Thanks. Github Reference URL : https://github.com/zane66/edk2/tree/zane66/master Use this shell script to duplicate this issue: if /i /s "ax" ne "aX" then echo "Not Equal" fi The origin code will echo "Not Equal". This change can fix this issue. Cc: Jaben Carsey Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zane Zhang --- ShellPkg/Library/UefiShellLevel1CommandsLib/If.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c index 35c5ca6835..94162b2dae 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c @@ -141,7 +141,7 @@ TestOperation ( // // string compare // - if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) > 0) || (StringCompare(&Compare1, &Compare2) > 0)) { + if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) > 0) || (!CaseInsensitive && StringCompare(&Compare1, &Compare2) > 0)) { return (TRUE); } } else { @@ -175,7 +175,7 @@ TestOperation ( // // string compare // - if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) < 0) || (StringCompare(&Compare1, &Compare2) < 0)) { + if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) < 0) || (!CaseInsensitive && StringCompare(&Compare1, &Compare2) < 0)) { return (TRUE); } } else { @@ -209,7 +209,7 @@ TestOperation ( // // string compare // - if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) == 0) || (StringCompare(&Compare1, &Compare2) == 0)) { + if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) == 0) || (!CaseInsensitive && StringCompare(&Compare1, &Compare2) == 0)) { return (TRUE); } } else { @@ -236,7 +236,7 @@ TestOperation ( // // string compare // - if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) != 0) || (StringCompare(&Compare1, &Compare2) != 0)) { + if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) != 0) || (!CaseInsensitive && StringCompare(&Compare1, &Compare2) != 0)) { return (TRUE); } } else { @@ -264,7 +264,7 @@ TestOperation ( // // string compare // - if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) >= 0) || (StringCompare(&Compare1, &Compare2) >= 0)) { + if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) >= 0) || (!CaseInsensitive && StringCompare(&Compare1, &Compare2) >= 0)) { return (TRUE); } } else { @@ -298,7 +298,7 @@ TestOperation ( // // string compare // - if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) <= 0) || (StringCompare(&Compare1, &Compare2) <= 0)) { + if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) <= 0) || (!CaseInsensitive && StringCompare(&Compare1, &Compare2) <= 0)) { return (TRUE); } } else { -- 2.16.2.windows.1