All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@shadowen.org>
To: Wolfram Sang <w.sang@pengutronix.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH][RESEND] checkpatch: Add warning for p0-patches
Date: Wed, 12 Nov 2008 13:55:22 +0000	[thread overview]
Message-ID: <20081112135522.GD8302@shadowen.org> (raw)
In-Reply-To: <1225467370-19143-1-git-send-email-w.sang@pengutronix.de>

On Fri, Oct 31, 2008 at 04:36:10PM +0100, Wolfram Sang wrote:
> Some people work internally with -p0-patches which has the danger that
> one forgets to convert them to -p1 before mainlining. Bitten myself and
> seen p0-patches in mailing lists occasionally, this patch adds a warning
> to checkpatch.pl in case a patch is -p0. If you really want, you can
> fool this check to generate false positives, this is why it just spits a
> warning. Making the check 100% proof is trickier than it looks, so let's
> start with a version which catches the cases of real use.
> 
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> ---
>  scripts/checkpatch.pl |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index f88bb3e..dae5854 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1051,6 +1051,7 @@ sub process {
>  	my $in_comment = 0;
>  	my $comment_edge = 0;
>  	my $first_line = 0;
> +	my $p1_prefix = '';
>  
>  	my $prev_values = 'E';
>  
> @@ -1196,7 +1197,12 @@ sub process {
>  		# extract the filename as it passes
>  		if ($line=~/^\+\+\+\s+(\S+)/) {
>  			$realfile = $1;
> -			$realfile =~ s@^[^/]*/@@;
> +			$realfile =~ s@^([^/]*)/@@;
> +
> +			$p1_prefix = $1;
> +			if ($tree && -e "$root/$p1_prefix") {
> +				WARN("Patch prefix '$p1_prefix' exists. Is it maybe a p0-patch?\n");
> +			}
>  
>  			if ($realfile =~ m@^include/asm/@) {
>  				ERROR("do not modify files in include/asm, change architecture specific files in include/asm-<architecture>\n" . "$here$rawline\n");

Looks reasonable.  Committed this with a few mods to my tree.  Will be
in the next batch of updates.

-apw

  reply	other threads:[~2008-11-12 13:55 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 [this message]
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
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=20081112135522.GD8302@shadowen.org \
    --to=apw@shadowen.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=w.sang@pengutronix.de \
    /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.