Messages in this thread | | | Date | Fri, 14 Nov 2008 07:49:19 +0100 | Subject | Re: [PATCH][RESEND] checkpatch: Add warning for p0-patches | From | Borislav Petkov <> |
| |
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.
| |