lkml.org 
[lkml]   [2008]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH][RESEND] checkpatch: Add warning for p0-patches
Hi Wolfram,

On Fri, Nov 14, 2008 at 10:38 AM, Wolfram Sang <w.sang@pengutronix.de> wrote:
> Hi Boris,
>
>> --- /dev/null 2008-11-09 02:46:02.525014459 +0100
>> +++ arch/x86/kernel/tsc_resync.c 2008-11-14 07:22:34.000000000 +0100
>> @@ -0,0 +1 @@
>> +This is a new file
>>
>> and, as you can see, it is a -p0 patch. Now, in the code you do:
>>
>> if ($tree && -e "$root/$p1_prefix") {
>> WARN("Patch prefix '$p1_prefix' exists. Is it maybe a p0-patch?\n");
>>
>> and the "$root/$p1_prefix" won't exist - as a matter of fact - would
>> lose its "arch" part due to the regex before and the if-condition won't
>> trigger.
>
> Careful. My approach is a bit different (inverse so to say) from yours
> which I missed back then. $p1_prefix is the part which _was_ cut off and
> it is wrong if it _does_ exist. See:
>
> - $realfile =~ s@^[^/]*/@@;
> + $realfile =~ s@^([^/]*)/@@;
> +
> + $p1_prefix = $1;

Doh, of course. I _did_ misinterpret the $p1_prefix, sorry. I was too
concentrated on the $realfile mangling.

> (So, a way to fool this algorithm is to give your kernel root dir the
> same name as a directory inside the root dir, like:
>
> --- drivers.orig/drivers/...
> +++ drivers/drivers/...
>
> This will generate a false positive. Oh, well...)
>
> I decided to go this way intentionally to handle the new file problem.
> So, in your case (I tried) it will cut off "arch", find the "arch"
> directory and will complain. (Did you actually apply this patch? ;))
>
> I thought the variable name 'p1_prefix' would speak for itself, but as
> you misinterpreted it, maybe it should be renamed?

No, keep it that way, for others who _can_ read, unlike me :).

--
Regards/Gruss,
Boris


\
 
 \ /
  Last update: 2008-11-14 11:45    [W:0.040 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site