Re: [PATCH][RESEND] checkpatch: Add warning for p0-patches
From: Borislav Petkov
Date: Fri Nov 14 2008 - 01:51:33 EST
Hi Wolfram,
On Thu, Nov 13, 2008 at 11:55:40PM +0100, Wolfram Sang wrote:
> Hello Boris,
>
> > files. Well, this one suffers from the exact opposite problem - it won't trigger
> > even if it is a -p0 patch on new files, AFAICT.
>
> Can you give an example, please? I fail to see this at the moment.
Watch this:
Here's an arbitrary piece of a patch one could create:
--- /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.
Nevertheless, this can be made to work if a special condition is added
which looks for "/dev/null" or similar strings which are a unique for a
patch adding a new file, or something like that. But I admit, this is a
contrived case and as such it is really rare in reality and you never
gonna have a problem like that if you use git or quilt :).
--
Regards/Gruss,
Boris.
--
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/