Re: checkpatch WARNING: patch prefix 'b' exists, appears to be a-p0 patch

From: Joe Perches
Date: Wed Oct 19 2011 - 12:17:38 EST


On Wed, 2011-10-19 at 13:22 +0200, Wolfram Sang wrote:
> > Maybe something as simple as a comment in the checkpatch source
> > to say that such a file / directory can cause false positives?
>
> I'd hope this error message would be clear enough, what do you think?
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 3dfc471..19e4de7 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1506,7 +1506,7 @@ sub process {
> if (!$file && $tree && $p1_prefix ne '' &&
> -e "$root/$p1_prefix") {
> WARN("PATCH_PREFIX",
> - "patch prefix '$p1_prefix' exists, appears to be a -p0 patch\n");
> + "patch prefix '$p1_prefix' exists as file/directory. Make sure this isn't a -p0 patch\n");
> }
>
> if ($realfile =~ m@^include/asm/@) {
>

How about:

scripts/checkpatch.pl | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2300964..6259b12 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1499,17 +1499,17 @@ sub process {
$realfile =~ s@^([^/]*)/@@;

} elsif ($line =~ /^\+\+\+\s+(\S+)/) {
+ my $patched_file = "$root/$1";
$realfile = $1;
$realfile =~ s@^([^/]*)/@@;

- $p1_prefix = $1;
- if (!$file && $tree && $p1_prefix ne '' &&
- -e "$root/$p1_prefix") {
+ if (!$file && $tree && $realfile ne '' &&
+ -e "$patched_file") {
WARN("PATCH_PREFIX",
- "patch prefix '$p1_prefix' exists, appears to be a -p0 patch\n");
+ "patched file '$patched_file' exists, patch appears to be a -p0 patch\n");
}

- if ($realfile =~ m@^include/asm/@) {
+ if ($patched_file =~ m@/include/asm/@) {
ERROR("MODIFIED_INCLUDE_ASM",
"do not modify files in include/asm, change architecture specific files in include/asm-<architecture>\n" . "$here$rawline\n");
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/