From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0534C433E2 for ; Tue, 1 Sep 2020 09:09:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 72C4320866 for ; Tue, 1 Sep 2020 09:09:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726536AbgIAJJE convert rfc822-to-8bit (ORCPT ); Tue, 1 Sep 2020 05:09:04 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:47347 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726526AbgIAJJC (ORCPT ); Tue, 1 Sep 2020 05:09:02 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-283-TOoGT-t2Oa-s63UZlOFx8A-1; Tue, 01 Sep 2020 10:07:44 +0100 X-MC-Unique: TOoGT-t2Oa-s63UZlOFx8A-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 1 Sep 2020 10:07:42 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Tue, 1 Sep 2020 10:07:42 +0100 From: David Laight To: 'Joe Perches' , Denis Efremov , LKML , Greg Kroah-Hartman , "Rafael J. Wysocki" , "Kees Cook" , "Gustavo A . R . Silva" , Julia Lawall , Alex Dewar CC: York Sun , Borislav Petkov , "Mauro Carvalho Chehab" , Tony Luck , "James Morse" , Robert Richter , Michal Simek , Boris Brezillon , "Maxim Levitsky" , Alex Dubov , Ulf Hansson , Tomas Winkler , "Arnd Bergmann" , Madalin Bucur , "David S. Miller" , Jakub Kicinski , "Douglas Miller" , Stanislav Yakovlev , Kalle Valo , Darren Hart , Andy Shevchenko , =?iso-8859-1?Q?Kai_M=E4kisara?= , "James E.J. Bottomley" , "Martin K. Petersen" , Mark Brown , Oliver Neukum , Pete Zaitcev , "linux-edac@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-i3c@lists.infradead.org" , "linux-mmc@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-wireless@vger.kernel.org" , "platform-driver-x86@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "linux-spi@vger.kernel.org" , "linux-usb@vger.kernel.org" Subject: RE: sysfs output without newlines Thread-Topic: sysfs output without newlines Thread-Index: AQHWfkO/+C/EB0p8Hk2MEQnp7JjooqlTgZKw Date: Tue, 1 Sep 2020 09:07:42 +0000 Message-ID: <5f0b48e0291b4b54bc1caeb8b5715c65@AcuMS.aculab.com> References: <0f837bfb394ac632241eaac3e349b2ba806bce09.camel@perches.com> <4cd6275c-6e95-3aeb-9924-141f62e00449@linux.com> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: aculab.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Content-Language: en-US Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org From: Joe Perches > Sent: 29 August 2020 21:34 ... > > On 8/29/20 9:23 PM, Joe Perches wrote: > > > While doing an investigation for a possible treewide conversion of > > > sysfs output using sprintf/snprintf/scnprintf, I discovered > > > several instances of sysfs output without terminating newlines. > > > > > > It seems likely all of these should have newline terminations > > > or have the \n\r termination changed to a single newline. > > > > I think that it could break badly written scripts in rare cases. > > Maybe. > > Is sysfs output a nominally unchangeable api like seq_? > Dunno. seq_ output is extended all the time. > > I think whitespace isn't generally considered part of > sscanf type input content awareness. The shell will remove trailing '\n' (but not '\r') from: foo=$(cat bar) So shell scripts are unlikely to be affected. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)