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.94; helo=esa3.dell-outbound.iphmx.com; envelope-from=jim.dailey@dell.com; receiver=edk2-devel@lists.01.org Received: from esa3.dell-outbound.iphmx.com (esa3.dell-outbound.iphmx.com [68.232.153.94]) (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 3CD6421180F22 for ; Tue, 30 Oct 2018 04:32:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dell.com; i=@dell.com; q=dns/txt; s=smtpout; t=1540899132; x=1572435132; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=DFeuye2D6AWN9APXis8yi7pGRRoRZdg1RMUQTtCVz/8=; b=J3VamNuKnTJ17exbCxoRivohrH5vdb22SDFGKp/SvU5csAEo734XMHul mgTZpPDL8KPiaa12B6U1T/T+/LRfi/x8fqxagpcD4+RU5y5jm5TnSHszg bqFCHOeGSiGdXYsCtbjf0CH3J4yNKuK8bpFHI3hzuoexN6zlhZeiV6EUP M=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2EFAABEQNhbhyWd50NkGwEBAQEDAQE?= =?us-ascii?q?BBwMBAQGBUQYBAQELAYNpKAqMBF+NRoF4lSiBegsBARiEVAKDJSI0DQ0BAwE?= =?us-ascii?q?BAgEBAgEBAhABAQEKCwkIKSMMgjYigmMBAQEBAwERKD8MBAIBCBEEAQEfCQc?= =?us-ascii?q?oHgkIAQEEAQ0FCBqCf4ICnSACgRCJWAEBAYIbiiaCLok5gheBEYMShQWFVAK?= =?us-ascii?q?IeZYXBwKMc4QMIJBIln8CBAIEBQIUgUOCDnCDPII0iDqFaW+KWYEfAQE?= X-IPAS-Result: =?us-ascii?q?A2EFAABEQNhbhyWd50NkGwEBAQEDAQEBBwMBAQGBUQYBA?= =?us-ascii?q?QELAYNpKAqMBF+NRoF4lSiBegsBARiEVAKDJSI0DQ0BAwEBAgEBAgEBAhABA?= =?us-ascii?q?QEKCwkIKSMMgjYigmMBAQEBAwERKD8MBAIBCBEEAQEfCQcoHgkIAQEEAQ0FC?= =?us-ascii?q?BqCf4ICnSACgRCJWAEBAYIbiiaCLok5gheBEYMShQWFVAKIeZYXBwKMc4QMI?= =?us-ascii?q?JBIln8CBAIEBQIUgUOCDnCDPII0iDqFaW+KWYEfAQE?= Received: from mx0b-00154901.pphosted.com ([67.231.157.37]) by esa3.dell-outbound.iphmx.com with ESMTP/TLS/AES256-SHA256; 30 Oct 2018 06:32:10 -0500 Received: from pps.filterd (m0089483.ppops.net [127.0.0.1]) by mx0b-00154901.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9UBRt77041537 for ; Tue, 30 Oct 2018 07:32:27 -0400 Received: from esa3.dell-outbound2.iphmx.com (esa3.dell-outbound2.iphmx.com [68.232.154.63]) by mx0b-00154901.pphosted.com with ESMTP id 2nedwsjf3v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 30 Oct 2018 07:32:27 -0400 From: Received: from ausxipps310.us.dell.com ([143.166.148.211]) by esa3.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA256; 30 Oct 2018 17:32:14 +0600 X-LoopCount0: from 10.166.136.214 X-IronPort-AV: E=Sophos;i="5.54,444,1534827600"; d="scan'208";a="276041170" To: , CC: Thread-Topic: [PATCH v2 1/2] ShellPkg-UefiShellLib: Add a function to fully-qualify paths Thread-Index: AdRvyvFMWA6pVzosSjCUose/JKCJhgAV+iZAAAgH8YA= Date: Tue, 30 Oct 2018 11:32:25 +0000 Message-ID: References: <517a9546603441cc868554cb350e8afe@ausx13mps335.AMER.DELL.COM> <734D49CCEBEEF84792F5B80ED585239D5BEE552B@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5BEE552B@SHSMSX104.ccr.corp.intel.com> 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-10-30T11:32:11.1240270Z; 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-10-30_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=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=811 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810300100 Subject: Re: [PATCH v2 1/2] ShellPkg-UefiShellLib: Add a function to fully-qualify paths X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 11:32:30 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable >-----Original Message----- >From: Ni, Ruiyu [mailto:ruiyu.ni@intel.com]=20 >Sent: Tuesday, October 30, 2018 2:33 AM >To: Dailey, Jim; edk2-devel@lists.01.org >Cc: Carsey, Jaben >Subject: RE: [PATCH v2 1/2] ShellPkg-UefiShellLib: Add a function to fully= -qualify paths > > >> -----Original Message----- >> From: Jim.Dailey@dell.com >> Sent: Tuesday, October 30, 2018 5:15 AM >> To: edk2-devel@lists.01.org >> Cc: Carsey, Jaben ; Ni, Ruiyu >> Subject: [PATCH v2 1/2] ShellPkg-UefiShellLib: Add a function to fully-q= ualify >> paths >>=20 >> +CHAR16* >> +EFIAPI >> +FullyQualifyPath( >> + IN CONST CHAR16 *Path >> + ) >> +{ >> + CONST CHAR16 *WorkingPath; >> + CONST CHAR16 *InputPath; >> + CHAR16 *InputFileSystem; >> + UINTN FileSystemCharCount; >> + CHAR16 *FullyQualifiedPath; >> + UINTN Size; >> + >> + FullyQualifiedPath =3D NULL; >> + >> + ASSERT(Path !=3D NULL); >> + // >> + // Handle erroneous input when asserts are disabled. >> + // >> + if (Path =3D=3D NULL) { >> + return NULL; >> + } >> + // >> + // In paths that contain ":", like fs0:dir/file.ext and fs2:\fqpath\f= ile.ext, >> + // we have to consider the file system part separately from the "pat= h" >> part. >> + // If there is a file system in the path, we have to get the current = working >> + // directory for that file system. Then we need to use the part of th= e path >> + // following the ":". If a path does not contain ":", we use it as g= iven. >> + // >> + InputPath =3D StrStr(Path, L":"); >> + if (InputPath !=3D NULL) { >> + InputPath++; >> + FileSystemCharCount =3D ((UINTN)InputPath - (UINTN)Path + >> sizeof(CHAR16)) / sizeof(CHAR16); >> + InputFileSystem =3D AllocateCopyPool(FileSystemCharCount * >> sizeof(CHAR16), Path); >> + if (InputFileSystem !=3D NULL) { >> + InputFileSystem[FileSystemCharCount - 1] =3D CHAR_NULL; >> + } >> + WorkingPath =3D ShellGetCurrentDir(InputFileSystem); >> + SHELL_FREE_NON_NULL(InputFileSystem); >> + // >> + // Handle the degenerate case where Path was only a file system >> reference. >> + // In that case we return the current working directory of the file= system. >> + // >> + if (InputPath =3D=3D NULL) { > >The "InputPath" should not be NULL. You are correct. It will simply point to an empty string if the input path is only a file system reference (e.g. "FS0:"). I thoughtlessly confused an empty string with NULL. :-( Do you want me to delete that comment and the "if" and resubmit, or, assumi= ng the rest of the patch is acceptable, do you want to delete it and push the modified patch? Regards, Jim