From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A9E3E1A1FCC for ; Thu, 22 Sep 2016 14:22:03 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 22 Sep 2016 14:21:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,379,1470726000"; d="scan'208";a="1034887585" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga001.jf.intel.com with ESMTP; 22 Sep 2016 14:21:54 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.80]) by fmsmsx107.amr.corp.intel.com ([169.254.6.183]) with mapi id 14.03.0248.002; Thu, 22 Sep 2016 14:21:54 -0700 From: "Carsey, Jaben" To: Tapan Shah , "edk2-devel@lists.01.org" CC: "Carsey, Jaben" Thread-Topic: [PATCH] ShellPkg: Expand special output file to include "NULL" and case insensitive Thread-Index: AQHSFQVTjQ10zCKe6UyB8kWI91k21qCGBJ4g Date: Thu, 22 Sep 2016 21:21:53 +0000 Message-ID: References: <1474571567-11852-1-git-send-email-tapandshah@hpe.com> In-Reply-To: <1474571567-11852-1-git-send-email-tapandshah@hpe.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDJjOGI5M2ItY2JkYy00NmM3LWI3NDEtM2FkZDBkMmM4MTZhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkhNTTc0R3g0TGRVWUtOVDMwYnd3YUx6KzRpendCWkk4Zk5NU3RKVFFVT3c9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.108] MIME-Version: 1.0 Subject: Re: [PATCH] ShellPkg: Expand special output file to include "NULL" and case insensitive X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2016 21:22:03 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jaben Carsey And commited. > -----Original Message----- > From: Tapan Shah [mailto:tapandshah@hpe.com] > Sent: Thursday, September 22, 2016 12:13 PM > To: edk2-devel@lists.01.org > Cc: Carsey, Jaben ; Tapan Shah > > Subject: [PATCH] ShellPkg: Expand special output file to include "NULL" a= nd > case insensitive > Importance: High >=20 > As per ECR 1349 change in UEFI Shell Specification 2.2, expanding > a special output file name to include "NULL". Previously it only > supported "NUL" as a special output file and it was case sensitive. > With this change both "NUL" and "NULL" are special output file and > checked as case insensitive. >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Tapan Shah > --- > ShellPkg/Application/Shell/ShellParametersProtocol.c | 3 ++- > ShellPkg/Application/Shell/ShellProtocol.c | 6 ++++-- > ShellPkg/Library/UefiShellLib/UefiShellLib.c | 14 +++++++++++++- > ShellPkg/Library/UefiShellLib/UefiShellLib.h | 2 ++ > ShellPkg/Library/UefiShellLib/UefiShellLib.inf | 2 ++ > 5 files changed, 23 insertions(+), 4 deletions(-) >=20 > diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c > b/ShellPkg/Application/Shell/ShellParametersProtocol.c > index 3684f9c..58156a2 100644 > --- a/ShellPkg/Application/Shell/ShellParametersProtocol.c > +++ b/ShellPkg/Application/Shell/ShellParametersProtocol.c > @@ -2,6 +2,7 @@ > Member functions of EFI_SHELL_PARAMETERS_PROTOCOL and functions > for creation, > manipulation, and initialization of EFI_SHELL_PARAMETERS_PROTOCOL. >=20 > + (C) Copyright 2016 Hewlett Packard Enterprise Development LP
> Copyright (C) 2014, Red Hat, Inc. > (C) Copyright 2013 Hewlett-Packard Development Company, L.P.
> Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
> @@ -1174,7 +1175,7 @@ UpdateStdInStdOutStdErr( > if (TempHandle =3D=3D NULL) { > Status =3D EFI_INVALID_PARAMETER; > } else { > - if (StrStr(StdOutFileName, L"NUL")=3D=3DStdOutFileName) { > + if (gUnicodeCollation->MetaiMatch (gUnicodeCollation, > StdOutFileName, L"NUL")) { > //no-op > } else if (!OutAppend && OutUnicode && !EFI_ERROR(Status)) { > Status =3D WriteFileTag (TempHandle); > diff --git a/ShellPkg/Application/Shell/ShellProtocol.c > b/ShellPkg/Application/Shell/ShellProtocol.c > index 6f29250..fb7dd84 100644 > --- a/ShellPkg/Application/Shell/ShellProtocol.c > +++ b/ShellPkg/Application/Shell/ShellProtocol.c > @@ -3,6 +3,7 @@ > manipulation, and initialization of EFI_SHELL_PROTOCOL. >=20 > (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
> + (C) Copyright 2016 Hewlett Packard Enterprise Development LP
> Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the = BSD > License > @@ -1287,9 +1288,10 @@ EfiShellOpenFileByName( > } >=20 > // > - // Is this for NUL file > + // Is this for NUL / NULL file > // > - if (StrCmp(FileName, L"NUL") =3D=3D 0) { > + if ((gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)FileName= , > L"NUL") =3D=3D 0) || > + (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)FileName= , > L"NULL") =3D=3D 0)) { > *FileHandle =3D &FileInterfaceNulFile; > return (EFI_SUCCESS); > } > diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c > b/ShellPkg/Library/UefiShellLib/UefiShellLib.c > index 3dcdba6..e47d535 100644 > --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c > +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c > @@ -1,6 +1,7 @@ > /** @file > Provides interface to shell functionality for shell commands and > applications. >=20 > + (C) Copyright 2016 Hewlett Packard Enterprise Development LP
> Copyright 2016 Dell Inc. > Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
> This program and the accompanying materials > @@ -36,6 +37,7 @@ EFI_SHELL_PROTOCOL *gEfiShellProtocol; > EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol; > EFI_HANDLE mEfiShellEnvironment2Handle; > FILE_HANDLE_FUNCTION_MAP FileFunctionMap; > +EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollationProtocol; >=20 > /** > Check if a Unicode character is a hexadecimal character. > @@ -290,12 +292,19 @@ ShellLibConstructor ( > IN EFI_SYSTEM_TABLE *SystemTable > ) > { > + EFI_STATUS Status; > + > mEfiShellEnvironment2 =3D NULL; > gEfiShellProtocol =3D NULL; > gEfiShellParametersProtocol =3D NULL; > mEfiShellInterface =3D NULL; > mEfiShellEnvironment2Handle =3D NULL; >=20 > + if (mUnicodeCollationProtocol =3D=3D NULL) { > + Status =3D gBS->LocateProtocol (&gEfiUnicodeCollation2ProtocolGuid, > NULL, (VOID**)&mUnicodeCollationProtocol); > + ASSERT_EFI_ERROR (Status); > + } > + > // > // verify that auto initialize is not set false > // > @@ -720,7 +729,10 @@ ShellOpenFileByName( > Status =3D gEfiShellProtocol->OpenFileByName(FileName, > FileHandle, > OpenMode); > - if (StrCmp(FileName, L"NUL") !=3D 0 && !EFI_ERROR(Status) && > ((OpenMode & EFI_FILE_MODE_CREATE) !=3D 0)){ > + > + if ((mUnicodeCollationProtocol->StriColl (mUnicodeCollationProtocol, > (CHAR16*)FileName, L"NUL") !=3D 0) && > + (mUnicodeCollationProtocol->StriColl (mUnicodeCollationProtocol, > (CHAR16*)FileName, L"NULL") !=3D 0) && > + !EFI_ERROR(Status) && ((OpenMode & EFI_FILE_MODE_CREATE) !=3D > 0)){ > FileInfo =3D FileFunctionMap.GetFileInfo(*FileHandle); > ASSERT(FileInfo !=3D NULL); > FileInfo->Attribute =3D Attributes; > diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.h > b/ShellPkg/Library/UefiShellLib/UefiShellLib.h > index 3596f7b..b323bcf 100644 > --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.h > +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.h > @@ -1,6 +1,7 @@ > /** @file > Provides interface to shell functionality for shell commands and > applications. >=20 > + (C) Copyright 2016 Hewlett Packard Enterprise Development LP
> Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the = BSD > License > @@ -25,6 +26,7 @@ > #include > #include > #include > +#include >=20 > #include > #include > diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.inf > b/ShellPkg/Library/UefiShellLib/UefiShellLib.inf > index 782649a..0be6828 100644 > --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.inf > +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.inf > @@ -1,6 +1,7 @@ > ## @file > # Provides interface to shell functionality for shell commands and > applications. > # > +# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
> # Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved. > # > # This program and the accompanying materials > @@ -51,6 +52,7 @@ >=20 > [Protocols] > gEfiSimpleFileSystemProtocolGuid ## SOMETIMES_CONSUMES > + gEfiUnicodeCollation2ProtocolGuid ## CONSUMES >=20 > # shell 2.0 > gEfiShellProtocolGuid ## SOMETIMES_CONSUMES > -- > 1.9.5.msysgit.0