From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.107.8.52; helo=eur04-vi1-obe.outbound.protection.outlook.com; envelope-from=supreeth.venkatesh@arm.com; receiver=edk2-devel@lists.01.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80052.outbound.protection.outlook.com [40.107.8.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5D23D211EA9FA for ; Fri, 29 Mar 2019 07:34:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=l5iauLmLLS2teJrxNRSspfpZX5HEV11YTn6IBPdqv34=; b=gegI4okouUJhXhzFKFqVe/++max6LkY4KQ/Jkc7o6HtQm/P/e2yKjvDre/tPcqUDQsIvbOPiLgIs7OhyoD1foVX7Q3WH5vA2cLHNe2/SM3Cww3rh5Hi43ukVj3t56K6J+K4Sc/GrS1Tjjia5O9FNF3UJkbIKCoI6TEfJVXfz9G4= Received: from AM4PR08MB2788.eurprd08.prod.outlook.com (10.170.126.27) by AM4PR08MB2916.eurprd08.prod.outlook.com (10.171.191.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Fri, 29 Mar 2019 14:34:32 +0000 Received: from AM4PR08MB2788.eurprd08.prod.outlook.com ([fe80::cc1a:f5ec:27c6:4136]) by AM4PR08MB2788.eurprd08.prod.outlook.com ([fe80::cc1a:f5ec:27c6:4136%3]) with mapi id 15.20.1730.019; Fri, 29 Mar 2019 14:34:32 +0000 From: Supreeth Venkatesh To: Minnow Ware , "Jin, Eric" , "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: AQHU5gnerr4OwnPwhEimznLGg/5zKKYiq2iAgAAA7zA= Date: Fri, 29 Mar 2019 14:34:32 +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: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Supreeth.Venkatesh@arm.com; x-originating-ip: [2600:1700:8c61:400:9dee:35fc:d60a:3373] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 23c084fd-d20c-4e8a-a314-08d6b453a8bf x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM4PR08MB2916; x-ms-traffictypediagnostic: AM4PR08MB2916: x-ms-exchange-purlcount: 4 x-microsoft-antispam-prvs: x-forefront-prvs: 0991CAB7B3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(396003)(376002)(39860400002)(366004)(136003)(189003)(199004)(40434004)(13464003)(236005)(14444005)(478600001)(5660300002)(316002)(52536014)(68736007)(790700001)(74316002)(7736002)(8936002)(110136005)(476003)(25786009)(99286004)(97736004)(2501003)(46003)(11346002)(486006)(6116002)(8676002)(81166006)(81156014)(86362001)(446003)(93886005)(229853002)(9686003)(6246003)(2906002)(256004)(186003)(102836004)(4326008)(6306002)(53936002)(105586002)(7696005)(106356001)(966005)(6436002)(71190400001)(71200400001)(45080400002)(33656002)(55016002)(54896002)(6506007)(76176011)(5024004)(53546011)(14454004)(72206003)(606006); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR08MB2916; H:AM4PR08MB2788.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 9XG5M+MWmxovR9AuGcXNe/2iAipRteuoS/bEU9IQHbrLz0CaD4Ne0VcVFwKk2ufNvVXOdUdfxBs4tfQYraItik7w3lbY41nunGSJDKew5AE4MmZO33vuMj7pq1BYJTiathH5QcCSzCGWtU92oW5CR3GNvP/0ai1n3W34t1XJEU9leCNwKvpKl5lJLSzSMm0MgzkiG+U+7i4EOksKvcb+xB9k3xfSdvctWoWrcvQ3zLYz5dzNybx0MkvYnVfWazzAVlT4G3efKd6UyHm1cKq8AHuQ/2nS352siN9qqkeqK3WB0/pdiTflF+PmgbXXNoI2hSZkPyEvy33+240DSzykIybVSuL683LGLJRGvFQyD5a6ASAGeIAPtHcg6gNkTI6P+BTO7Q7iRujN52dCMuesU82Pd1bUPRrKQ7P/nrAzhY0= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23c084fd-d20c-4e8a-a314-08d6b453a8bf X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Mar 2019 14:34:32.5430 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR08MB2916 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:34:37 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks Kilian. There was no issue. This patch was sent in error. However, I will look into this feedback - "The GenBin.c should be extended = by a manual BIN2TXT translation." Supreeth From: Minnow Ware Sent: Friday, March 29, 2019 9:29 AM To: Jin, Eric ; 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, theoretically the standard C implementation of fopen(char *filename, char *= mode) "can" support BINARY and TEXT mode. This is specified here http://www.open-= std.org/jtc1/sc22/wg14/www/docs/n1256.pdf, "7.19.2 Streams" In praxis only Windows-/DOS platforms supports a BINARY ( w/ "b") and a TEX= T mode (w/o "b"). 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 "\n" only, when reading the file to the buffer. And on write operations each "\n" is transformed to "\r\n". On UNIX-systems with or without "b"-inary flag do not affect the data read/= 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 Venkatesh Sent: Friday, March 29, 2019 7:08 AM To: supreeth.venkatesh@arm.com; edk2-dev= el@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 IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.