From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.92.71.63; helo=eur03-db5-obe.outbound.protection.outlook.com; envelope-from=minnowware@outlook.com; receiver=edk2-devel@lists.01.org Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-oln040092071063.outbound.protection.outlook.com [40.92.71.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0BD0B211EA9FA for ; Fri, 29 Mar 2019 07:29:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7lLiWGQzFm8nV46CVq4dmy+L4XC8o7yydcOEdCG6ULc=; b=hlw/2SZF2aeFRP0pj2qlUmh00nrCCaNYy+Dugqi5pIgWaeucfjMS6tHMujOZVDbYjRpfeVZlozFtUzkiYmI5XQ7eFFWR3H8Uyem506OLN6cKLdjUcWgCmhJPXFQZvsTj4UEb/EyEvcgsXNinDaoky3DzWcJGVXg9sSGcLlx9cvzFTpSVM10XL+Kk68cBzoFrv+FELFFADxezQlFJxjCGgWEyyJASa6Z+TPxjvbrCWV/74nyO4PCKWPuqVooOHWbyU6H0JETYJbrZosIm2anWhm9Wh4XEOdIGWr0QqGvSfrkAdwEE94iMKQa0Qk10bKRovHFmpanCkW0YQWIO7E6PrQ== Received: from VE1EUR03FT017.eop-EUR03.prod.protection.outlook.com (10.152.18.52) by VE1EUR03HT240.eop-EUR03.prod.protection.outlook.com (10.152.19.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.16; Fri, 29 Mar 2019 14:28:57 +0000 Received: from AM5PR04MB2993.eurprd04.prod.outlook.com (10.152.18.51) by VE1EUR03FT017.mail.protection.outlook.com (10.152.18.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.16 via Frontend Transport; Fri, 29 Mar 2019 14:28:57 +0000 Received: from AM5PR04MB2993.eurprd04.prod.outlook.com ([fe80::6db5:ab5e:e97a:149c]) by AM5PR04MB2993.eurprd04.prod.outlook.com ([fe80::6db5:ab5e:e97a:149c%4]) with mapi id 15.20.1730.019; Fri, 29 Mar 2019 14:28:57 +0000 From: Minnow Ware To: "Jin, Eric" , Supreeth Venkatesh , "edk2-devel@lists.01.org" CC: "Jin, Eric" Thread-Topic: [edk2] [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line ending detection by GenBin tool Thread-Index: AQHU5bw/40/JXmyaz02W9trJOc1G4KYiSDmAgABay30= Date: Fri, 29 Mar 2019 14:28:57 +0000 Message-ID: References: <1543397402-19411-1-git-send-email-lokesh.bv@arm.com> <1543397402-19411-5-git-send-email-lokesh.bv@arm.com>, In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:7EF484FCA7797C6BA8F16172F5835A4585237C3F893C2BF33DB23C9775A0A3EE; UpperCasedChecksum:32C957D3CCAFB5D7370C9A8430302C9ADFDBD9AEF7AE349EAB335B05AC09B9C6; SizeAsReceived:7174; Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [LN3VjyOV4j0kfCG4ck/qqq/prBLhvKzO] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(20181119110)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(9123020)(9118020)(2017031323274)(2017031324274)(2017031322404)(1601125500)(1603101475)(1701031045); SRVR:VE1EUR03HT240; x-ms-traffictypediagnostic: VE1EUR03HT240: x-microsoft-antispam-message-info: knUufVa2837ZZOC/J+qvdHyA0dWQgk2Kr6+SetJFBQU2Vh7Q8pnUP6bukHrOwuMJ MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: e3c25282-4e06-4f9e-af7e-08d6b452e13c X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Mar 2019 14:28:57.7821 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR03HT240 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line ending detection by GenBin tool 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: Fri, 29 Mar 2019 14:29:01 -0000 Content-Language: en-US Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hi Supreeth, theoretically the standard C implementation of fopen(char *filename, char *= mode) =93can=94 support BINARY and TEXT mode. This is specified here http://www.o= pen-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf, =937.19.2 Streams=94 In praxis only Windows-/DOS platforms supports a BINARY ( w/ =93b=94) and a= TEXT mode (w/o =93b=94). This is valid for all C-library implementations on that platforms. In textmode all "\r\n"-sequences in the file are automatically (by the C Li= brary) translated to =93\n=94 only, when reading the file to the buffer. And on write operations each =93\n=94 is transformed to =93\r\n=94. On UNIX-systems with or without =93b=94-inary flag do not affect the data r= ead/written. Since the profile file is opened correctly in text mode (Line 107 https://g= ithub.com/tianocore/edk2-test/blob/master/uefi-sct/SctPkg/Tools/Source/GenB= in/GenBin.c), the issue tells me, you are running on a UNIX system, dealing with Windows = text files. The GenBin.c should be extended by a manual BIN2TXT translation. Best Regrads, Kilian https://github.com/MinnowWare From: Jin, Eric Sent: Friday, March 29, 2019 09:31 AM To: Supreeth Venkatesh; edk2-devel@lists= .01.org Cc: Jin, Eric Subject: Re: [edk2] [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line = ending detection by GenBin tool Hi Supreeth, This patch can't be applied to the lasted code base SHA-1: 33022e. One patch from may already fix the issue. Please check again. Best Regards Eric -----Original Message----- From: edk2-devel On Behalf Of Supreeth Ve= nkatesh Sent: Friday, March 29, 2019 7:08 AM To: supreeth.venkatesh@arm.com; edk2-devel@lists.01.org Subject: [edk2] [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line endi= ng detection by GenBin tool From: Lokesh B V Some windows editors uses "\r\n" for line feed. While processing uefi sct t= estcase info file, the GenBin tool logic to skip line feed doesn't consider= the presence of carraige return(\r) in line feed. So this results in incor= rect format error. Fixed this issue by changing logic of Trim and Getline functions used in Ge= nBin source code. Cc: Supreeth Venkatesh Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Lokesh B V --- Changes since v1: * Adopted changes suggested by Supreeth. * modified Copyright content uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c | 58 +++++++++++++-----------= ---- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c b/uefi-sct/SctPkg= /Tools/Source/GenBin/GenBin.c index 61bb35b..6d8e844 100644 --- a/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c +++ b/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c @@ -2,6 +2,7 @@ Copyright 2006 - 2010 Unified EFI, Inc.
Copyright (c) 2010 Intel Corporation. All rights reserved.
+ Copyright (c) 2018 ARM Ltd. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -32,6 +33,7 @@ Abstract: #include #include #include +#include // // Definitions @@ -49,7 +51,7 @@ PrintUsage ( void ); -void +char * Trim ( char *String ); @@ -159,50 +161,42 @@ PrintUsage ( } -void +char * Trim ( char *String ) { - int Index1; - int Index2; int Length; + char *end; Length =3D strlen (String); - // - // Remove the space characters from the beginning of this string - // - for (Index1 =3D 0; Index1 < Length; Index1++) { - if ((String[Index1] !=3D ' ' ) && - (String[Index1] !=3D '\t') && - (String[Index1] !=3D '\n')) { - break; - } - } - - for (Index2 =3D Index1; Index2 < Length; Index2++) { - String[Index2 - Index1] =3D String[Index2]; + if (!Length) { + return String; } - Length =3D Length - Index1; + end =3D String + Length - 1; // // Remove the space characters from the end of this string // - for (Index1 =3D 0; Index1 < Length; Index1++) { - if ((String[Length - 1 - Index1] !=3D ' ' ) && - (String[Length - 1 - Index1] !=3D '\t') && - (String[Length - 1 - Index1] !=3D '\n')) { - break; - } + while (end >=3D String && isspace (*end)) { + end--; } - String[Length - Index1] =3D '\0'; + *(end + 1) =3D '\0'; + + // + // Remove the space characters from the beginning of this string // + while (*String && isspace (*String)) { + String++; + } // // Done // + return String; } @@ -227,20 +221,20 @@ GetLine ( return -1; } - (*LineNo)++; - // // Remove the beginning and ending space characters // - Trim (String); + String =3D Trim (Result); // - // Ignore the empty line and comment line + // Skip the empty line and comment line // - if ((String[0] !=3D '\0') && - (String[0] !=3D '#' )) { - break; + if ((String[0] =3D=3D '\0') || + (String[0] =3D=3D '#' )) { + continue; } + + (*LineNo)++; } // -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel