From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 5B01221959CB2 for ; Wed, 24 Oct 2018 11:03:09 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2018 11:03:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,421,1534834800"; d="scan'208";a="90944893" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by FMSMGA003.fm.intel.com with ESMTP; 24 Oct 2018 11:03:08 -0700 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 24 Oct 2018 11:03:08 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.16]) by fmsmsx122.amr.corp.intel.com ([169.254.5.127]) with mapi id 14.03.0319.002; Wed, 24 Oct 2018 11:03:08 -0700 From: "Carsey, Jaben" To: "Jim.Dailey@dell.com" , "edk2-devel@lists.01.org" CC: "Ni, Ruiyu" Thread-Topic: [edk2] [PATCH 2/2] ShellPkg-Shell App: Provide fully-qualified path to shell scripts Thread-Index: AdRrtt/Peq0w9jRkT8+1otJrwLN4oAADMs0g Date: Wed, 24 Oct 2018 18:03:07 +0000 Message-ID: References: <1185bb5068c0413794f299f573401b74@ausx13mps335.AMER.DELL.COM> In-Reply-To: <1185bb5068c0413794f299f573401b74@ausx13mps335.AMER.DELL.COM> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTVlNDk1ZDAtNWQ3ZS00NjEzLTkxZDEtODRkOTYwYWE3MjFiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiWmRZS3FRdzJLRE53XC9LTTJvYTc1bXBaeUs1eDlTN1FqRlFcL2d1RVEwNXNWSlZJYWQ4bm1MYXkxczI3OFBsN0lrIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.1.200.106] MIME-Version: 1.0 Subject: Re: [PATCH 2/2] ShellPkg-Shell App: Provide fully-qualified path to shell scripts 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, 24 Oct 2018 18:03:09 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Looks good to me. Ray? Reviewed-by: Jaben Carsey p.s. Ray if you agree you can RB and I will handle the push. > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Jim.Dailey@dell.com > Sent: Wednesday, October 24, 2018 9:36 AM > To: edk2-devel@lists.01.org > Cc: Ni, Ruiyu ; Carsey, Jaben > Subject: [edk2] [PATCH 2/2] ShellPkg-Shell App: Provide fully-qualified p= ath > to shell scripts > Importance: High >=20 > Section 3.6.2 of version 2.2 of the shell specification requires that > the first positional argument (i.e. arg 0) of a shell script resolves > to "the full path name of the script itself." >=20 > Ensure that the startup script and any scripts launched by the shell > meet this requirement. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Jim Dailey > --- > ShellPkg/Application/Shell/Shell.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) >=20 > diff --git a/ShellPkg/Application/Shell/Shell.c > b/ShellPkg/Application/Shell/Shell.c > index 6185b6ac80..fe88177d57 100644 > --- a/ShellPkg/Application/Shell/Shell.c > +++ b/ShellPkg/Application/Shell/Shell.c > @@ -3,6 +3,7 @@ >=20 > Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
> (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.
> + Copyright 2018 Dell Technologies.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the = BSD > License > which accompanies this distribution. The full text of the license may= be > found at > @@ -1275,7 +1276,8 @@ DoStartupScript( >=20 > FileStringPath =3D LocateStartupScript (ImagePath, FilePath); > if (FileStringPath !=3D NULL) { > - Status =3D RunScriptFile (FileStringPath, NULL, L"", > ShellInfoObject.NewShellParametersProtocol); > + FileStringPath =3D FullyQualifyPath(&FileStringPath); > + Status =3D RunScriptFile (FileStringPath, NULL, FileStringPath, > ShellInfoObject.NewShellParametersProtocol); > FreePool (FileStringPath); > } else { > // > @@ -2474,6 +2476,7 @@ RunCommandOrFile( > } > switch (Type) { > case Script_File_Name: > + CommandWithPath =3D FullyQualifyPath(&CommandWithPath); > Status =3D RunScriptFile (CommandWithPath, NULL, CmdLine, > ParamProtocol); > break; > case Efi_Application: > @@ -2812,7 +2815,12 @@ RunScriptFileHandle ( > DeleteScriptFileStruct(NewScriptFile); > return (EFI_OUT_OF_RESOURCES); > } > - for (LoopVar =3D 0 ; LoopVar < 10 && LoopVar < NewScriptFile->Argc; > LoopVar++) { > + // > + // Put the full path of the script file into Argv[0] as required by = section > + // 3.6.2 of version 2.2 of the shell specification. > + // > + NewScriptFile->Argv[0] =3D StrnCatGrow(&NewScriptFile->Argv[0], NULL= , > NewScriptFile->ScriptName, 0); > + for (LoopVar =3D 1 ; LoopVar < 10 && LoopVar < NewScriptFile->Argc; > LoopVar++) { > ASSERT(NewScriptFile->Argv[LoopVar] =3D=3D NULL); > NewScriptFile->Argv[LoopVar] =3D StrnCatGrow(&NewScriptFile- > >Argv[LoopVar], NULL, ShellInfoObject.NewShellParametersProtocol- > >Argv[LoopVar], 0); > if (NewScriptFile->Argv[LoopVar] =3D=3D NULL) { > -- > 2.17.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel