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: <CAK7LNAQxsUheo2dHn5E=4ACafcYL9zNubgiVkJkANuZkx2RgpA@mail.gmail.com>
Date:   Mon, 13 May 2019 19:11:46 +0900
From:   Masahiro Yamada <yamada.masahiro@...ionext.com>
To:     Joe Perches <joe@...ches.com>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Andy Whitcroft <apw@...onical.com>
Subject: Re: [Proposal] end of file checks by checkpatch.pl

Hi Joe,

On Fri, May 10, 2019 at 2:20 AM Joe Perches <joe@...ches.com> wrote:
>
> On Fri, 2019-05-10 at 00:27 +0900, Masahiro Yamada wrote:
> > Hi Joe,
> >
> >
> > Does it make sense to check the following
> > by checkpatch.pl ?
> >
> >
> > [1] blank line at end of file
>
>
> > [2] no new line at end of file
>
> I'm pretty sure checkpatch does one this already.
> (around line 3175)
>
> # check for adding lines without a newline.
>                 if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) {
>                         WARN("MISSING_EOF_NEWLINE",
>                              "adding a line without newline at end of file\n" . $herecurr);
>                 }


I did not know this. Thanks.

Looks like the report depends on the file type.

scripts/checkpatch.pl  -f  arch/sparc/lib/NG4clear_page.S
scripts/checkpatch.pl  -f  tools/power/cpupower/bench/cpufreq-bench_plot.sh

reported it, but

scripts/checkpatch.pl  -f  drivers/media/dvb-frontends/cxd2880/Kconfig
scripts/checkpatch.pl  -f  drivers/parport/Makefile

did not.

>
> > When I apply a patch,
> > I sometimes see the following warning from 'git am'.
> >
> >
> > Applying: kunit: test: add string_stream a std::stream like string builder
> > .git/rebase-apply/patch:223: new blank line at EOF.
> > +
> >
> >
> > I just thought it could be checked
> > before the patch submission.
>
> perhaps:
> ---
>  scripts/checkpatch.pl | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 1c421ac42b07..ceb32c584ee5 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3356,6 +3356,12 @@ sub process {
>                         $last_blank_line = $linenr;
>                 }
>
> +# check the last line isn't blank
> +               if ($linenr >= $#rawlines && $line =~ /^\+\s*$/) {
> +                       WARN("LINE_SPACING",
> +                            "Avoid blank lines at EOF\n" . $herecurr);
> +               }
> +
>  # check for missing blank lines after declarations
>                 if ($sline =~ /^\+\s+\S/ &&                     #Not at char 1
>                         # actual declarations
>
>

Worked for me.
(but Makefile, Kconfig were not checked though)


Could you commit it ?

Tested-by: Masahiro Yamada <yamada.masahiro@...ionext.com>

Thanks.

-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ