lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 05 May 2020 13:54:43 -0700 From: Joe Perches <joe@...ches.com> To: Pali Rohár <pali@...nel.org> Cc: Geert Uytterhoeven <geert+renesas@...der.be>, Andy Whitcroft <apw@...onical.com>, Konstantin Ryabitsev <konstantin@...uxfoundation.org>, Andrew Morton <akpm@...ux-foundation.org>, linux-kernel@...r.kernel.org, users@...ux.kernel.org Subject: Re: [kernel.org users] [PATCH v2] checkpatch: use patch subject when reading from stdin On Tue, 2020-05-05 at 22:40 +0200, Pali Rohár wrote: > Hello! > > On Tuesday 05 May 2020 12:57:37 Joe Perches wrote: > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > > index eac40f0abd56a9f4..3355358697d9e790 100755 > > > --- a/scripts/checkpatch.pl > > > +++ b/scripts/checkpatch.pl > > > @@ -1057,6 +1057,10 @@ for my $filename (@ARGV) { > > > } > > > while (<$FILE>) { > > > chomp; > > > + if ($vname eq 'Your patch') { > > > + my ($subject) = $_ =~ /^Subject:\s*(.*)/; > > > + $vname = '"' . $subject . '"' if $subject; > > > + } > > > push(@rawlines, $_); > > > } > > > close($FILE); > > > > There's a less cpu intensive way to do this, > > for small patches, on my little laptop it's a > > few dozen milliseconds faster, and for very > > large patches multiple seconds faster to use > > the following patch: > > > > Substitute Geert's patch with the below but: > > > > Acked-by: Joe Perches <joe@...ches.com> > > > > --- > > > > scripts/checkpatch.pl | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > index f0092104ff7b..29786a097862 100755 > > --- a/scripts/checkpatch.pl > > +++ b/scripts/checkpatch.pl > > @@ -1062,6 +1062,7 @@ for my $filename (@ARGV) { > > while (<$FILE>) { > > chomp; > > push(@rawlines, $_); > > + $vname = "\"$1\"" if ($filename eq '-' && $_ =~ /^Subject:\s*(.*)/); > > Hint: You can use qq operator to make code more readable (no need to > escape quote character). And maybe you should match Subject as > case-insensitive and expects at least one space after colon. > As a Perl developer I would write above code as: > > + $vname = qq("$1") if $filename eq '-' && $_ =~ m/^Subject:\s+(.+)/i; > > Anyway, what would happen if subject line contains quotes? Hi Pali. bad things... ;) so your suggestion is better. But/And checkpatch uses parens for if statements. cheers and thanks, Joe
Powered by blists - more mailing lists