lkml.org 
[lkml]   [2011]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [patch v4] checkpatch: Signature format verification
From
Date
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





\
 
 \ /
  Last update: 2011-05-27 22:21    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site