All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <w.sang@pengutronix.de>
To: petkovbb@gmail.com, Andy Whitcroft <apw@shadowen.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][RESEND] checkpatch: Add warning for p0-patches
Date: Fri, 14 Nov 2008 10:38:53 +0100	[thread overview]
Message-ID: <20081114093853.GA3152@pengutronix.de> (raw)
In-Reply-To: <20081114064919.GB29121@gollum.tnic>

[-- Attachment #1: Type: text/plain, Size: 1601 bytes --]

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;

(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?

All the best,

   Wolfram

-- 
  Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2008-11-14  9:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-31 15:36 [PATCH][RESEND] checkpatch: Add warning for p0-patches Wolfram Sang
2008-11-12 13:55 ` Andy Whitcroft
2008-11-12 14:23   ` Borislav Petkov
2008-11-13 22:55     ` Wolfram Sang
2008-11-14  6:49       ` Borislav Petkov
2008-11-14  9:38         ` Wolfram Sang [this message]
2008-11-14 10:43           ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081114093853.GA3152@pengutronix.de \
    --to=w.sang@pengutronix.de \
    --cc=apw@shadowen.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=petkovbb@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.