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: <CAHp75VePn6w6aN=+DW85rC9qSytBQSVaHjUC_QsmEqxaXYoz+A@mail.gmail.com>
Date:   Mon, 13 Apr 2020 23:15:28 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Joe Perches <joe@...ches.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Andy Whitcroft <apw@...dowen.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] checkpatch: Additional MAINTAINER section entry ordering checks

On Mon, Apr 13, 2020 at 11:12 PM Joe Perches <joe@...ches.com> wrote:
>
> There is a preferred order for the entries in MAINTAINERS sections.
>
> See:
>
> commit 3b50142d8528 ("MAINTAINERS: sort field names for all entries")
> and
> commit 6680125ea5a2 ("MAINTAINERS: list the section entries in the preferred order)
>
> Add checkpatch tests to try to keep that ordering.
>

Good one, thanks!
FWIW,
Acked-by: Andy Shevchenko <andy.shevchenko@...il.com>

> Signed-off-by: Joe Perches <joe@...ches.com>
> ---
>  scripts/checkpatch.pl | 45 +++++++++++++++++++++++++++++++++++++--------
>  1 file changed, 37 insertions(+), 8 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index d64c67..3c44833 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3060,14 +3060,43 @@ sub process {
>                         #print "is_start<$is_start> is_end<$is_end> length<$length>\n";
>                 }
>
> -# check for MAINTAINERS entries that don't have the right form
> -               if ($realfile =~ /^MAINTAINERS$/ &&
> -                   $rawline =~ /^\+[A-Z]:/ &&
> -                   $rawline !~ /^\+[A-Z]:\t\S/) {
> -                       if (WARN("MAINTAINERS_STYLE",
> -                                "MAINTAINERS entries use one tab after TYPE:\n" . $herecurr) &&
> -                           $fix) {
> -                               $fixed[$fixlinenr] =~ s/^(\+[A-Z]):\s*/$1:\t/;
> +# check MAINTAINERS entries
> +               if ($realfile =~ /^MAINTAINERS$/) {
> +# check MAINTAINERS entries for the right form
> +                       if ($rawline =~ /^\+[A-Z]:/ &&
> +                           $rawline !~ /^\+[A-Z]:\t\S/) {
> +                               if (WARN("MAINTAINERS_STYLE",
> +                                        "MAINTAINERS entries use one tab after TYPE:\n" . $herecurr) &&
> +                                   $fix) {
> +                                       $fixed[$fixlinenr] =~ s/^(\+[A-Z]):\s*/$1:\t/;
> +                               }
> +                       }
> +# check MAINTAINERS entries for the right ordering too
> +                       my $preferred_order = 'MRLSWQBCPTFXNK';
> +                       if ($rawline =~ /^\+[A-Z]:/ &&
> +                           $prevrawline =~ /^[\+ ][A-Z]:/) {
> +                               $rawline =~ /^\+([A-Z]):\s*(.*)/;
> +                               my $cur = $1;
> +                               my $curval = $2;
> +                               $prevrawline =~ /^[\+ ]([A-Z]):\s*(.*)/;
> +                               my $prev = $1;
> +                               my $prevval = $2;
> +                               my $curindex = index($preferred_order, $cur);
> +                               my $previndex = index($preferred_order, $prev);
> +                               if ($curindex < 0) {
> +                                       WARN("MAINTAINERS_STYLE",
> +                                            "Unknown MAINTAINERS entry type: '$cur'\n" . $herecurr);
> +                               } else {
> +                                       if ($previndex >= 0 && $curindex < $previndex) {
> +                                               WARN("MAINTAINERS_STYLE",
> +                                                    "Misordered MAINTAINERS entry - list '$cur:' before '$prev:'\n" . $hereprev);
> +                                       } elsif ((($prev eq 'F' && $cur eq 'F') ||
> +                                                 ($prev eq 'X' && $cur eq 'X')) &&
> +                                                ($prevval cmp $curval) > 0) {
> +                                               WARN("MAINTAINERS_STYLE",
> +                                                    "Misordered MAINTAINERS entry - list file patterns in alphabetic order\n" . $hereprev);
> +                                       }
> +                               }
>                         }
>                 }
>
>


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ