From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 18A4381940 for ; Wed, 4 Jan 2017 09:07:51 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP; 04 Jan 2017 09:07:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,459,1477983600"; d="scan'208";a="49273694" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga005.jf.intel.com with ESMTP; 04 Jan 2017 09:07:50 -0800 Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 4 Jan 2017 09:07:50 -0800 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.47]) by FMSMSX102.amr.corp.intel.com ([169.254.10.201]) with mapi id 14.03.0248.002; Wed, 4 Jan 2017 09:07:50 -0800 From: "Carsey, Jaben" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: "Chen, Chen A" , chen881220 , "Carsey, Jaben" Thread-Topic: [edk2] [PATCH] ShellPkg: Fix a bug ">>v" cannot append data to environment variable Thread-Index: AQHSZjnn/3ddzQQ6bEml55oGXcxR2KEojYPw Date: Wed, 4 Jan 2017 17:07:49 +0000 Message-ID: References: <20170104032308.476512-1-ruiyu.ni@intel.com> In-Reply-To: <20170104032308.476512-1-ruiyu.ni@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZGYxYjI5MzQtMTcxNC00NmZjLWFiMTktMDE0ODY3ZjkzYmI2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImRMRllcLzFEdFVEUnhiZkZBelJvSUJVNFpidVZQTEluQ3laajFDU1RWcnRVPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.108] MIME-Version: 1.0 Subject: Re: [PATCH] ShellPkg: Fix a bug ">>v" cannot append data to environment variable X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2017 17:07:51 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jaben Carsey Please verify appropriate copyright before commit (I guess this file needs = year update). > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Ruiyu Ni > Sent: Tuesday, January 03, 2017 7:23 PM > To: edk2-devel@lists.01.org > Cc: Carsey, Jaben ; Chen, Chen A > ; chen881220 > Subject: [edk2] [PATCH] ShellPkg: Fix a bug ">>v" cannot append data to > environment variable > Importance: High >=20 > From: chen881220 >=20 > When ">v" is used to redirect the command output to environment > variable, the ending "\r\n\0" is removed before setting to environment > variable but the length is not updated. > It causes ">>v" fails to append data to the environment variable > created by ">v". > The patch fixes the above bug. >=20 > Signed-off-by: Chen A Chen > Cc: Ruiyu Ni > Cc: Jaben Carsey > --- > ShellPkg/Application/Shell/FileHandleWrappers.c | 4 ++++ > 1 file changed, 4 insertions(+) >=20 > diff --git a/ShellPkg/Application/Shell/FileHandleWrappers.c > b/ShellPkg/Application/Shell/FileHandleWrappers.c > index 3c11d82..67ca8e7 100644 > --- a/ShellPkg/Application/Shell/FileHandleWrappers.c > +++ b/ShellPkg/Application/Shell/FileHandleWrappers.c > @@ -1074,6 +1074,10 @@ FileInterfaceEnvClose( > (((CHAR16*)NewBuffer)[TotalSize / sizeof (CHAR16) - 3] =3D=3D > CHAR_CARRIAGE_RETURN) > ) { > ((CHAR16*)NewBuffer)[TotalSize / sizeof (CHAR16) - 3] =3D CHAR_N= ULL; > + // > + // If the NewBuffer end with \r\n\0, We will repace '\r' by '\0'= and then > update TotalSize. > + // > + TotalSize -=3D sizeof(CHAR16) * 2; > } >=20 > if (Volatile) { > -- > 2.9.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel