lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOFm3uEzpr7idZQz4kBCDwZ32uFwaYU3hsVoQwYw_gys3M_xjg@mail.gmail.com>
Date:   Fri, 9 Feb 2018 06:58:03 +0100
From:   Philippe Ombredanne <pombredanne@...b.com>
To:     Joe Perches <joe@...ches.com>
Cc:     Rob Herring <robh@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Andy Whitcroft <apw@...onical.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH v6] checkpatch.pl: Add SPDX license tag check

On Fri, Feb 9, 2018 at 1:35 AM, Joe Perches <joe@...ches.com> wrote:
> On Fri, 2018-02-02 at 13:18 -0800, Joe Perches wrote:
>> On Fri, 2018-02-02 at 09:40 -0600, Rob Herring wrote:
>> > Add SPDX license tag check based on the rules defined in
>> > Documentation/process/license-rules.rst. To summarize, SPDX license tags
>> > should be on the 1st line (or 2nd line in scripts) using the appropriate
>> > comment style for the file type.
>> >
>> > Cc: Andy Whitcroft <apw@...onical.com>
>> > Cc: Joe Perches <joe@...ches.com>
>> > Cc: Thomas Gleixner <tglx@...utronix.de>
>> > Cc: Philippe Ombredanne <pombredanne@...b.com>
>> > Acked-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
>> > Signed-off-by: Rob Herring <robh@...nel.org>
>>
>> Signed-off-by: Joe Perches <joe@...ches.com>
>
> Andrew, would you pick this up please?
>
>> > ---
>> > v6:
>> > - Dropped script extension check and only look for #!/... on 1st line. A
>> >   text executable file was not reliable either.
>> > - Support .awk and .tc which may or may not have a #!/.
>> > - Fixed a typo in script "#!" regex and also match on first /.
>> > - Add Greg's ack.
>> >
>> >  scripts/checkpatch.pl | 27 +++++++++++++++++++++++++++
>> >  1 file changed, 27 insertions(+)
>> >
>> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> > index ba03f17ff662..6db245e5f93b 100755
>> > --- a/scripts/checkpatch.pl
>> > +++ b/scripts/checkpatch.pl
>> > @@ -2225,6 +2225,8 @@ sub process {
>> >
>> >     my $camelcase_file_seeded = 0;
>> >
>> > +   my $checklicenseline = 1;
>> > +
>> >     sanitise_line_reset();
>> >     my $line;
>> >     foreach my $rawline (@rawlines) {
>> > @@ -2416,6 +2418,7 @@ sub process {
>> >                     } else {
>> >                             $check = $check_orig;
>> >                     }
>> > +                   $checklicenseline = 1;
>> >                     next;
>> >             }
>> >
>> > @@ -2866,6 +2869,30 @@ sub process {
>> >                     }
>> >             }
>> >
>> > +# check for using SPDX license tag at beginning of files
>> > +           if ($realline == $checklicenseline) {
>> > +                   if ($rawline =~ /^[ \+]\s*\#\!\s*\//) {
>> > +                           $checklicenseline = 2;
>> > +                   } elsif ($rawline =~ /^\+/) {
>> > +                           my $comment = "";
>> > +                           if ($realfile =~ /\.(h|s|S)$/) {
>> > +                                   $comment = '/*';
>> > +                           } elsif ($realfile =~ /\.(c|dts|dtsi)$/) {
>> > +                                   $comment = '//';
>> > +                           } elsif (($checklicenseline == 2) || $realfile =~ /\.(sh|pl|py|awk|tc)$/) {
>> > +                                   $comment = '#';
>> > +                           } elsif ($realfile =~ /\.rst$/) {
>> > +                                   $comment = '..';
>> > +                           }
>> > +
>> > +                           if ($comment !~ /^$/ &&
>> > +                               $rawline !~ /^\+\Q$comment\E SPDX-License-Identifier: /) {
>> > +                                   WARN("SPDX_LICENSE_TAG",
>> > +                                        "Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\n" . $herecurr);
>> > +                           }
>> > +                   }
>> > +           }
>> > +
>> >  # check we are in a valid source file if not then ignore this hunk
>> >             next if ($realfile !~ /\.(h|c|s|S|sh|dtsi|dts)$/);
>> >

BTW I forgot this if you like to add it:

Acked-by: Philippe Ombredanne <pombredanne@...b.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ