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] [thread-next>] [day] [month] [year] [list]
Message-ID: <ea57f41e30f962227855d4f60a93c89a6bf0b2f0.camel@perches.com>
Date:   Tue, 03 Dec 2019 00:56:16 -0800
From:   Joe Perches <joe@...ches.com>
To:     Krzysztof Kozlowski <krzk@...nel.org>
Cc:     Jani Nikula <jani.nikula@...ux.intel.com>,
        Andy Whitcroft <apw@...onical.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
Subject: Re: [PATCH] checkpatch: Look for Kconfig indentation errors

On Tue, 2019-12-03 at 16:40 +0800, Krzysztof Kozlowski wrote:
> On Thu, 28 Nov 2019 at 17:35, Joe Perches <joe@...ches.com> wrote:
> > On Thu, 2019-11-28 at 11:29 +0200, Jani Nikula wrote:
> > > On Thu, 28 Nov 2019, Krzysztof Kozlowski <krzk@...nel.org> wrote:
> > > > Kconfig should be indented with one tab for first level and tab+2 spaces
> > > > for second level.  There are many mixups of this so add a checkpatch
> > > > rule.
> > > > 
> > > > Signed-off-by: Krzysztof Kozlowski <krzk@...nel.org>
> > > 
> > > I agree unifying the indentation is nice, and without something like
> > > this it'll start bitrotting before Krzysztof's done fixing them all... I
> > > think there's been quite a few fixes merged lately.
> > > 
> > > I approve of the idea, but I'm clueless about the implementation.
> > 
> > I think that a grammar, or a least an array of words
> > that are supposed to start on a tab should be used here.
> 
> This won't work for wrong indentation of help text. This is quite
> popular Kconfig indentation violation so worth checking. I can then
> check for:
> 1. any white-space violations before array of Kconfig words - that
> 2. spaces mixed with tab before any text,
> 3. just spaces before any text,
> 4. tab + wrong number of spaces before any text.
> 
> It would look like:
> +               if ($realfile =~ /Kconfig/ &&
> +                   (($rawline =~
> /^\+\s+(?:config|menuconfig|choice|endchoice|if|endif|menu|endmenu|source|bool|tristate|prompt|help|---help---|depends|select)\b/

Many of these are not correct.

config, menuconfig, choice, endchoice, source
are primarily used at the beginning of a line.

if is odd as it's a logical block or test

It really needs a lex grammar to work properly.



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ