Re: [PATCH v2] checkpatch: Warn if missing author Signed-off-by

From: Joe Perches
Date: Wed Jul 11 2018 - 13:24:30 EST


On Wed, 2018-07-11 at 19:07 +0200, Geert Uytterhoeven wrote:
> Hi Joe,

Rehi Geert.

> On Wed, Jul 11, 2018 at 6:20 PM Joe Perches <joe@xxxxxxxxxxx> wrote:
> > On Wed, 2018-07-11 at 17:10 +0200, Geert Uytterhoeven wrote:
> > > Print a warning if none of the Signed-off-by lines cover the patch
> > > author.
> > >
> > > Non-ASCII quoted printable encoding in From: headers and (lack of)
> > > double quotes are handled.
> > > Split From: headers are not fully handled: only the first part is
> > > compared.
> >
> > []
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> >
> > []
> > > +# Check the patch for a From:
> > > + if (decode("MIME-Header", $line) =~ /^From:\s*(.*)/) {
> > > + $author = encode("utf8", $1);
> > > + $author =~ s/"//g;
> > > + }
> > > +
> > > # Check the patch for a signoff:
> > > if ($line =~ /^\s*signed-off-by:/i) {
> > > $signoff++;
> > > $in_commit_log = 0;
> > > + if ($author ne '') {
> > > + my $l = $line;
> > > + $l =~ s/"//g;
> > > + if ($l =~ /^\s*signed-off-by: \Q$author\E/i) {

if (/^\s*signed-off-by:\s*\Q$author\E/i)

> > > + $authorsignoff = 1;
> > > + }
> > > + }
> > > }
> >
> > I don't see the point of removing the quotes.
>
> If the name contains a dot (e.g. "David S. Miller"), it must be protected
> by double quotes in the From: email header, but that is usually not the case
> in the Sob line.

Right.
It seems it's unusual for SOBs to use quotes around names.

> > Another somewhat frequent Signed-off-by: defect pattern
> > is to have a lower-case name or no name at all used.
> >
> > Perhaps it'd be useful to add some checks like
> > a single word for a name and all lower-case names:
> >
> > e.g.:
> > Signed-off-by: joe perches <joe@xxxxxxxxxxx>
> >
> > emits
> >
> > Unusual lower case name: 'joe perches <joe@xxxxxxxxxxx>'
> >
> > and
> > Signed-off-by: root <root@xxxxxxxxxxxx>
> > and
> > Signed-off-by: Root <root@xxxxxxxxxxxx>
> > and
> > Signed-off-by: root@xxxxxxxxxxxx
> >
> > all emit that a single or missing name is unusual.
>
> Perhaps. But adding email addresses is not the topic of this patch.

Just another possible improvement if you're feeling energetic.

cheers, Joe