mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: anish singh <anish198519851985@gmail.com>
Cc: Joe Perches <joe@perches.com>,
	Manish Kumar Singh <man.k1983@gmail.com>,
	davej@redhat.com, apw@shadowen.org, akpm@linux-foundation.org,
	vapier@gentoo.org, linux-kernel@vger.kernel.org
Subject: Re: [patch v4] checkpatch: Signature format verification
Date: Fri, 27 May 2011 16:18:26 -0400	[thread overview]
Message-ID: <1306527506.3857.41.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <BANLkTi=dsYi3ViZdpGdagxzhzDRuRVL_+A@mail.gmail.com>

On Sat, 2011-05-28 at 01:24 +0530, anish singh wrote:
> 

>         
>         Anish, do you have a response to this?
> Your approach is correct but i am trying to do in my own way.

Why?? Correct is more important than individual preferences.

>         
>         > I have replaced b/w with "between".
>         > And as Manish rightly exlained this patch is not meant for
>         > email validation.
>         
>         
>         Yet it does incorrectly anyway to nominally skip
>         name and find <.*>.  That's the problem.
>         
>         Look again at the patterns:
>         
>         +                               if ($line =~ /^\s*$sign(.*)/i)
>         {
>         +                                       if ($1 !~ /^\s
>         +([a-zA-Z\s\"\.\-\'\,]*.*)/i) {

Note, why the []? Because you basically have:

	/^\s+([blahblah]*.*)/

which is the same as:

	/^\s+(.*)/

>         +                                               WARN("Space
>         required after $sign\n" .
>         +
>         $herecurr);
>         
>         +                                       }
>  
> here i am trying to check space between sign & name.
> In first if loop i am checking if sign is present in line or not.
> If yes, enter into second if loop & check if $1 starts with space 
> or not(which takes care of checking space between sign & name).
> In this if loop again i am catching name & rest of the things in $1.
> $1 will be used for checking space between name & mail-id.

BTW, people hate perl for this very reason. This subtle changing of $1
is very hard to follow if you are not a perl expert. I use perl all the
time (recordmcount.pl and ktest.pl), but if you look at my code, you
will see that I purposely avoid these subtle characteristics of perl,
because that's the (very rightfully so) reason people complain that perl
is a write once and never maintain language.

I understood from the beginning what you were doing, but I had to think
about it more than I should have.

>         
>         and
>         
>         +                                       if ($1 !~ /([\sa-zA-Z
>         \"\.\-\'\,]*)\s<.*>/i) {
>         +                                               WARN("Space
>         required b/w Full Name & Mail-id:\n" .
>         +
>         $herecurr);
>         
>         +                                       }


You really need to get a new MUA.
>         
>         
>  
> In this If loop i am using $1 (returned by earlier pattern)  to check
> space 
> between mail and <mail-id>.
> If we print $1 after last if loop, we can get name appropriately.
> So, i am not skipping name here to match <>.
>  
> I will change <.*> to <.*?> (non-greedy match) for matching very first
> enclosing bracket.

Again, this doesn't explain the space warning when I have just his:

 Signed-off-by: <me@foo.bar>

Because that will not match the above, because the $1 will be
"<me@foo.bar>". With no space.


-- Steve




  parent reply	other threads:[~2011-05-27 20:18 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-21 19:38 PATCH] patch to generate warning when signed-of line in patch in not proper anish
2011-05-21 19:52 ` Joe Perches
2011-05-22 10:18 ` [patch v2] checkpatch: Signature format verification anish
2011-05-22 14:16   ` Joe Perches
     [not found]     ` <BANLkTimMPvn87E0EEqT4vhox4_8nQ4pMug@mail.gmail.com>
2011-05-23  4:14       ` Joe Perches
2011-05-23 16:22         ` Steven Rostedt
2011-05-23 16:30           ` Joe Perches
2011-05-23 15:21   ` [patch v3] " anish
2011-05-23 16:11     ` Joe Perches
     [not found]       ` <BANLkTi=9nzMbxU0=P+pOaHcebqhL=bd2HQ@mail.gmail.com>
2011-05-23 16:36         ` Joe Perches
2011-05-23 16:39           ` Randy Dunlap
2011-05-23 16:42             ` Joe Perches
     [not found]               ` <BANLkTik8coVxt=Z92NQBNH_=4yRhTtexzA@mail.gmail.com>
2011-05-23 17:07                 ` Randy Dunlap
2011-05-23 17:18                 ` Joe Perches
     [not found]                   ` <BANLkTikqezyJMy1_i-woTVM9bvVL750iew@mail.gmail.com>
2011-05-23 18:09                     ` Joe Perches
2011-05-23 22:51                       ` Mike Frysinger
2011-05-24  1:24                         ` Valdis.Kletnieks
2011-05-24  1:31                           ` Mike Frysinger
2011-05-24  4:44                             ` Randy Dunlap
2011-05-27 18:01     ` [patch v4] " anish
2011-05-27 18:16       ` Steven Rostedt
2011-05-27 18:18         ` Randy Dunlap
2011-05-27 18:45         ` Joe Perches
2011-05-27 18:58           ` Joe Perches
2011-05-27 19:22           ` Steven Rostedt
2011-05-27 19:33             ` Joe Perches
2011-05-27 18:29       ` Joe Perches
     [not found]         ` <BANLkTikfh_ABGomn-Lm9Ugc7MzeRodwiEQ@mail.gmail.com>
2011-05-27 19:08           ` Joe Perches
     [not found]             ` <BANLkTi=JK+XS2D0exj=unjpjGCsnVncCzQ@mail.gmail.com>
2011-05-27 19:33               ` Joe Perches
     [not found]                 ` <BANLkTi=dsYi3ViZdpGdagxzhzDRuRVL_+A@mail.gmail.com>
2011-05-27 20:18                   ` Steven Rostedt [this message]
2011-05-27 20:37                     ` Joe Perches
     [not found]                     ` <BANLkTi=VuLpdAf3Qo3mo_nQ03yHazeHf+g@mail.gmail.com>
2011-05-28  1:42                       ` Joe Perches
2011-05-27 22:14       ` Andrew Morton

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=1306527506.3857.41.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=anish198519851985@gmail.com \
    --cc=apw@shadowen.org \
    --cc=davej@redhat.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=man.k1983@gmail.com \
    --cc=vapier@gentoo.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®