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 1A3DA2118847D for ; Wed, 31 Oct 2018 04:27:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dell.com; i=@dell.com; q=dns/txt; s=smtpout; t=1540985255; x=1572521255; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=6bGuN2o5k3mDEqvv3kaBXqsofGTc82kLeHGgTOvGHkE=; b=0sF65mdutukUNtrZ3PZQdLPAEm6gijpZwUUhtmVs3eJUZoekGNI3UwDs JlkeFiLPpbb4Shyzo5kVAw+vZFmaRIbEhcolf2l1wYFUgiM8rYgmHbE1V lw+Sh4yUTFkkbsTPyBUTp2ZN0yU0SGRpZ8VpWgqNNAVX1e7hyYhIvYbXf Y=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2EFAAAFj9lbhyWd50NkGwEBAQEDAQE?= =?us-ascii?q?BBwMBAQGBUQYBAQELAYNXEigKjARfjT+BeJUvgXoLAQEYhFQCg1g0DQ0BAwE?= =?us-ascii?q?BAgEBAgEBAhABAQEKCwkIKSMMgjYigmMBAQEEAREoPwwEAgEIEQQBAR8JByg?= =?us-ascii?q?eCQgBAQQOBQgagn+CApw3AoEQiVgBAQGCG4ougi6LUoERgxKFBYVUAokClh0?= =?us-ascii?q?HAox1hA0gkE+UZYIlAgQCBAUCFIFDgg5wgzyCNIg6hWlvizWBHwEB?= X-IPAS-Result: =?us-ascii?q?A2EFAAAFj9lbhyWd50NkGwEBAQEDAQEBBwMBAQGBUQYBA?= =?us-ascii?q?QELAYNXEigKjARfjT+BeJUvgXoLAQEYhFQCg1g0DQ0BAwEBAgEBAgEBAhABA?= =?us-ascii?q?QEKCwkIKSMMgjYigmMBAQEEAREoPwwEAgEIEQQBAR8JBygeCQgBAQQOBQgag?= =?us-ascii?q?n+CApw3AoEQiVgBAQGCG4ougi6LUoERgxKFBYVUAokClh0HAox1hA0gkE+UZ?= =?us-ascii?q?YIlAgQCBAUCFIFDgg5wgzyCNIg6hWlvizWBHwEB?= Received: from mx0b-00154901.pphosted.com (HELO mx0a-00154901.pphosted.com) ([67.231.157.37]) by esa5.dell-outbound.iphmx.com with ESMTP/TLS/AES256-SHA256; 31 Oct 2018 06:27:33 -0500 Received: from pps.filterd (m0089484.ppops.net [127.0.0.1]) by mx0b-00154901.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9VBMdMA027680 for ; Wed, 31 Oct 2018 07:27:33 -0400 Received: from esa1.dell-outbound2.iphmx.com (esa1.dell-outbound2.iphmx.com [68.232.153.201]) by mx0b-00154901.pphosted.com with ESMTP id 2nfaw807mq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 31 Oct 2018 07:27:33 -0400 From: Received: from ausxippc106.us.dell.com ([143.166.85.156]) by esa1.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA256; 31 Oct 2018 17:27:22 +0600 X-LoopCount0: from 10.166.136.215 X-IronPort-AV: E=Sophos;i="5.54,447,1534827600"; d="scan'208";a="313242282" To: CC: , Thread-Topic: [PATCH v2 1/2] ShellPkg-UefiShellLib: Add a function to fully-qualify paths Thread-Index: AdRvyvFMWA6pVzosSjCUose/JKCJhgAV+iZAAAgH8YAALdzFMAAEbJsQ Date: Wed, 31 Oct 2018 11:27:31 +0000 Message-ID: <063b9052d04648e2890f0f95232929df@ausx13mps335.AMER.DELL.COM> References: <517a9546603441cc868554cb350e8afe@ausx13mps335.AMER.DELL.COM> <734D49CCEBEEF84792F5B80ED585239D5BEE552B@SHSMSX104.ccr.corp.intel.com> <734D49CCEBEEF84792F5B80ED585239D5BEE8E87@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5BEE8E87@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-31T11:23:20.0510841Z; 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-31_05:, , 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=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810310095 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: Wed, 31 Oct 2018 11:27:36 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Yes, Ray, that is the code block that I meant. It serves no purpose since InputPath cannot possibly be NULL in that part of the code. I appreciate your help in deleting this block and pushing the rest of the patch. Also, thanks for your thorough review of this code (and the first version)! Regards, Jim -----Original Message----- From: Ni, Ruiyu [mailto:ruiyu.ni@intel.com]=20 Sent: Wednesday, October 31, 2018 4:18 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 Jim, I checked the other parts in your patch. They looks good. But I don't quite understand how to handle the if-statement. Do you mean to remove the below code block? // // Handle the degenerate case where Path was only a file system referen= ce. // In that case we return the current working directory of the file sys= tem. // if (InputPath =3D=3D NULL) { InputPath =3D L""; } If yes, I can remove it for you and push the patch. Thanks/Ray > -----Original Message----- > From: Jim.Dailey@dell.com > Sent: Tuesday, October 30, 2018 7:32 PM > To: Ni, Ruiyu ; edk2-devel@lists.01.org > Cc: Carsey, Jaben > Subject: RE: [PATCH v2 1/2] ShellPkg-UefiShellLib: Add a function to full= y- > qualify paths >=20 > >-----Original Message----- > >From: Ni, Ruiyu [mailto:ruiyu.ni@intel.com] > >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-qualify paths > >> > >> +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\file.ext, // we have to consider the file system part > separately from the "path" > >> 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 the path // following the ":". If a path does not = contain > ":", we use it as given. > >> + // > >> + 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 fi= le > system. > >> + // > >> + if (InputPath =3D=3D NULL) { > > > >The "InputPath" should not be NULL. >=20 > You are correct. It will simply point to an empty string if the input pa= th is only > a file system reference (e.g. "FS0:"). I thoughtlessly confused an empty = string > with NULL. :-( >=20 > Do you want me to delete that comment and the "if" and resubmit, or, > assuming the rest of the patch is acceptable, do you want to delete it an= d > push the modified patch? >=20 > Regards, > Jim