From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Laight Subject: RE: sysfs output without newlines 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> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Return-path: In-Reply-To: Content-Language: en-US Sender: linux-spi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org 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 List-Id: platform-driver-x86.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)