From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 1BB2D21A0BAA9 for ; Mon, 15 May 2017 11:00:50 -0700 (PDT) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 May 2017 11:00:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,346,1491289200"; d="scan'208";a="101910007" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga005.fm.intel.com with ESMTP; 15 May 2017 11:00:49 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 15 May 2017 11:00:49 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.204]) by FMSMSX154.amr.corp.intel.com ([169.254.6.147]) with mapi id 14.03.0319.002; Mon, 15 May 2017 11:00:49 -0700 From: "Carsey, Jaben" To: Jeff Westfahl , "edk2-devel@lists.01.org" CC: "Ni, Ruiyu" Thread-Topic: [edk2][PATCH v2] ShellPkg/Ls: Handle path specified from root Thread-Index: AQHSzZ83R3LMd2RCY0Sj+/jQBRixGqH1rxqQ Date: Mon, 15 May 2017 18:00:48 +0000 Message-ID: References: <1494868679-12262-1-git-send-email-jeff.westfahl@ni.com> In-Reply-To: <1494868679-12262-1-git-send-email-jeff.westfahl@ni.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDYwZDc0NjMtNzI0NS00NmM4LWJhYjItOWU2ZjZlYmY2MjhlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IjI5cko5dSt3TlBTUjNjdzJtVVZZQUFYaXB1aWV6K054dEY1SGdlYmRrdU09In0= x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.108] MIME-Version: 1.0 Subject: Re: [PATCH v2] ShellPkg/Ls: Handle path specified from root X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 May 2017 18:00:50 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jaben Carsey > -----Original Message----- > From: Jeff Westfahl [mailto:jeff.westfahl@ni.com] > Sent: Monday, May 15, 2017 10:18 AM > To: edk2-devel@lists.01.org > Cc: Jeff Westfahl ; Ni, Ruiyu ; > Carsey, Jaben > Subject: [edk2][PATCH v2] ShellPkg/Ls: Handle path specified from root > Importance: High >=20 > This fixes 'ls' when specifying a path from the root, like "ls \" from > within a subfolder. Currently, 'ls' will append the specified path to the > current working directory. The correct behavior is to start from the root > of the currently selected filesystem. >=20 > Cc: Ruiyu Ni > Cc: Jaben Carsey > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jeff Westfahl > --- > ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c | 3 +++ > 1 file changed, 3 insertions(+) >=20 > diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c > b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c > index 8d33392..8eeb2c0 100644 > --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c > +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c > @@ -685,6 +685,9 @@ ShellCommandRunLs ( > ShellCommandLineFreeVarList (Package); > return SHELL_OUT_OF_RESOURCES; > } > + if (PathName[0] =3D=3D L'\\') { > + while (PathRemoveLastItem(FullPath)) ; > + } > Size =3D FullPath !=3D NULL? StrSize(FullPath) : 0; > StrnCatGrow(&FullPath, &Size, L"\\", 0); > } > -- > 2.7.4