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, 25 Aug 2020 14:23:06 +0200 From: Rasmus Villemoes <linux@...musvillemoes.dk> To: Joe Perches <joe@...ches.com>, Andrew Morton <akpm@...ux-foundation.org> Cc: Andy Whitcroft <apw@...dowen.org>, LKML <linux-kernel@...r.kernel.org> Subject: Re: [PATCH] checkpatch: Allow not using -f with files that are in git On 25/08/2020 02.09, Joe Perches wrote: > If a file exists in git and checkpatch is used without the -f > flag for scanning a file, then checkpatch will scan the file > assuming it's a patch and emit: > > ERROR: Does not appear to be a unified-diff format patch > > Change the behavior to assume the -f flag if the file exists > in git. Heh, I read the patch subject to mean you introduced a way for subsystem maintainers to prevent running checkpatch -f on their files, which I think some would like ;) > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index 79fc357b18cd..cdee7cfadc11 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -976,6 +976,16 @@ sub seed_camelcase_includes { > } > } > > +sub git_is_single_file { > + my ($filename) = @_; > + > + return 0 if ((which("git") eq "") || !(-e "$gitroot")); > + > + my $output = `${git_command} ls-files -- $filename`; > + my $count = $output =~ tr/\n//; > + return $count eq 1 && $output =~ m{^${filename}$}; > +} Isn't that somewhat expensive to do for each file? Why not postpone that check till we're about to complain that the file is not a diff (haven't looked at how such a refactoring would look). Rasmus
Powered by blists - more mailing lists