From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVPYP-00082F-F3 for qemu-devel@nongnu.org; Thu, 04 Aug 2016 16:47:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bVPYJ-0004fc-Q6 for qemu-devel@nongnu.org; Thu, 04 Aug 2016 16:47:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43008) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVPYJ-0004fW-KE for qemu-devel@nongnu.org; Thu, 04 Aug 2016 16:47:39 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C6315C04D2A5 for ; Thu, 4 Aug 2016 20:47:38 +0000 (UTC) References: <1470224274-31522-1-git-send-email-armbru@redhat.com> <1470224274-31522-2-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <57A3A9E9.2050506@redhat.com> Date: Thu, 4 Aug 2016 14:47:37 -0600 MIME-Version: 1.0 In-Reply-To: <1470224274-31522-2-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="i37tkGcftmMtMJEHQ8Auvck0O4vPuRAaM" Subject: Re: [Qemu-devel] [PATCH 1/4] error: Strip trailing '\n' from error string arguments (again) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --i37tkGcftmMtMJEHQ8Auvck0O4vPuRAaM Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/03/2016 05:37 AM, Markus Armbruster wrote: > Commit 9af9e0f, 6daf194d, be62a2eb and 312fd5f got rid of a bunch, but > they keep coming back. checkpatch.pl tries to flag them since commit > 5d596c2, but it's not very good at it. Offenders tracked down with > Coccinelle script scripts/coccinelle/err-bad-newline.cocci, an updated > version of the script from commit 312fd5f. >=20 > Signed-off-by: Markus Armbruster > --- > +++ b/scripts/coccinelle/err-bad-newline.cocci > @@ -0,0 +1,29 @@ > +// Error messages should not contain newlines. This script finds > +// messages that do. Fixing them is manual. > +@r@ > +expression errp, eno, cls, fmt; > +position p; > +@@ > +( > +error_report(fmt, ...)@p So you use Coccinelle to find error messages... > +@script:python@ > +fmt << r.fmt; > +p << r.p; > +@@ > +if "\\n" in str(fmt): > + print "%s:%s:%s:%s" % (p[0].file, p[0].line, p[0].column, fmt) =2E..and python to then parse the format string and flag violations. Slick. Does it still work across formats like "foo %" PRIdMAX "\n"? Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --i37tkGcftmMtMJEHQ8Auvck0O4vPuRAaM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXo6npAAoJEKeha0olJ0NqxrEIAIHCdk/qZ3VNachae0wol/oz MFyoRs6V6wRVOVs8JfdY/XxAu6CBB1JWQouOtepAQFFq+2ekQ4T/fFBb1/5Zzvz0 i9Z4lT06z4rj0njUewRlJnpLkvC7Bh9rKxdOEalS82EYw2buXHgbKjn1HiELEMcp quCy6h7D0D73/EwQ1MYbaMc5Y/NEm2wxhn+JM+63/Xc3MkHDuc8O32zBfFlFNxpR 6wEu+EIhDYGoQeGuxDTbKZ55v/cFmTKL1mTPVPWdo4utF+C72RkDmpFT/Avko4x7 y7OXtf8TYNyEiQxeuQjFcUaBDw74wfC/KNgZTbUzkn6w04uLk6u73+1Gs5BamEs= =aB/A -----END PGP SIGNATURE----- --i37tkGcftmMtMJEHQ8Auvck0O4vPuRAaM--