From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=68.232.149.214; helo=esa4.dell-outbound.iphmx.com; envelope-from=jim.dailey@dell.com; receiver=edk2-devel@lists.01.org Received: from esa4.dell-outbound.iphmx.com (esa4.dell-outbound.iphmx.com [68.232.149.214]) (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 15F4A2116DA0D for ; Wed, 24 Oct 2018 09:35:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dell.com; i=@dell.com; q=dns/txt; s=smtpout; t=1540398949; x=1571934949; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=yUYfZ5ixm3dLjh1uDH2lIDL81zNUZC24Rm34/9895eQ=; b=MZbCBdLmiuJU2S4/RRfMIcS+93aSUUay9rsStYe557We/fXLdHz4ufAh TUKZwjpXZ/UZBdkPH75aMqX9GvMaMIFdA6DaWnuKdqVtWhyfZhQTXsM9R VDpQdLnHlXusa9NU6r4+K81hm/Jc1yI7tlrInHA/YA4Vi/Y/UewxW6Sx0 E=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2EWAAAuntBbhyeV50NjHQEBBQEHBQG?= =?us-ascii?q?BUQgBCwGDVxIoCowDX488lR4UgWYLAQGEbIMvNA0NAQMBAQIBAQIBAQIQAQE?= =?us-ascii?q?BCgsJCCkvgjYigmYWFRM/EgE+aAEEDgUIGoJ/ggKef4lXAQEBgWgziiWKRYM?= =?us-ascii?q?0gRGHVYEIhQ0CiFKFeg+PdQcCjk+CHR+QMJZEAgQCBAUCFIFDgg5wgzyCNBu?= =?us-ascii?q?OCG+MDoEfAQE?= X-IPAS-Result: =?us-ascii?q?A2EWAAAuntBbhyeV50NjHQEBBQEHBQGBUQgBCwGDVxIoC?= =?us-ascii?q?owDX488lR4UgWYLAQGEbIMvNA0NAQMBAQIBAQIBAQIQAQEBCgsJCCkvgjYig?= =?us-ascii?q?mYWFRM/EgE+aAEEDgUIGoJ/ggKef4lXAQEBgWgziiWKRYM0gRGHVYEIhQ0Ci?= =?us-ascii?q?FKFeg+PdQcCjk+CHR+QMJZEAgQCBAUCFIFDgg5wgzyCNBuOCG+MDoEfAQE?= Received: from mx0a-00154901.pphosted.com (HELO mx0b-00154901.pphosted.com) ([67.231.149.39]) by esa4.dell-outbound.iphmx.com with ESMTP/TLS/AES256-SHA256; 24 Oct 2018 11:35:48 -0500 Received: from pps.filterd (m0090350.ppops.net [127.0.0.1]) by mx0b-00154901.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9OGXNHE103467 for ; Wed, 24 Oct 2018 12:35:47 -0400 Received: from esa2.dell-outbound2.iphmx.com (esa2.dell-outbound2.iphmx.com [68.232.153.202]) by mx0b-00154901.pphosted.com with ESMTP id 2nankbjdxx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 24 Oct 2018 12:35:47 -0400 From: Received: from ausxippc101.us.dell.com ([143.166.85.207]) by esa2.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA256; 24 Oct 2018 22:35:09 +0600 X-LoopCount0: from 10.166.136.215 X-IronPort-AV: E=Sophos;i="5.54,421,1534827600"; d="scan'208";a="1152443050" To: CC: , Thread-Topic: [edk2][PATCH 2/2] ShellPkg-Shell App: Provide fully-qualified path to shell scripts Thread-Index: AdRrtt/Peq0w9jRkT8+1otJrwLN4oA== Date: Wed, 24 Oct 2018 16:35:45 +0000 Message-ID: <1185bb5068c0413794f299f573401b74@ausx13mps335.AMER.DELL.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-24T16:29:40.8833621Z; 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-24_06:, , 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=826 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810240141 Subject: [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 16:35:49 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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." Ensure that the startup script and any scripts launched by the shell meet this requirement. 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(-) diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shel= l/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 BS= D License which accompanies this distribution. The full text of the license may b= e found at @@ -1275,7 +1276,8 @@ DoStartupScript( =20 FileStringPath =3D LocateStartupScript (ImagePath, FilePath); if (FileStringPath !=3D NULL) { - Status =3D RunScriptFile (FileStringPath, NULL, L"", ShellInfoObject.N= ewShellParametersProtocol); + FileStringPath =3D FullyQualifyPath(&FileStringPath); + Status =3D RunScriptFile (FileStringPath, NULL, FileStringPath, ShellI= nfoObject.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, ParamP= rotocol); 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; Lo= opVar++) { + // + // Put the full path of the script file into Argv[0] as required by se= ction + // 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; Lo= opVar++) { ASSERT(NewScriptFile->Argv[LoopVar] =3D=3D NULL); NewScriptFile->Argv[LoopVar] =3D StrnCatGrow(&NewScriptFile->Argv[Lo= opVar], NULL, ShellInfoObject.NewShellParametersProtocol->Argv[LoopVar], 0)= ; if (NewScriptFile->Argv[LoopVar] =3D=3D NULL) { --=20 2.17.0.windows.1