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]
Date:   Wed, 18 Aug 2021 13:21:16 -0700
From:   Joe Perches <joe@...ches.com>
To:     Denis Efremov <efremov@...ux.com>, linux-kselftest@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>
Cc:     linux-kernel@...r.kernel.org, linux-block@...r.kernel.org,
        Jens Axboe <axboe@...nel.dk>, Jiri Kosina <jkosina@...e.cz>,
        Willy Tarreau <w@....eu>
Subject: Re: [RFC PATCH 1/5] checkpatch: improve handling of revert commits

On Wed, 2021-08-18 at 19:21 +0300, Denis Efremov wrote:
> 
> On 8/18/21 7:00 PM, Joe Perches wrote:
> > On Wed, 2021-08-18 at 18:46 +0300, Denis Efremov wrote:
> > > Properly handle commits like:
> > > commit f2791e7eadf4 ("Revert "floppy: refactor open() flags handling"")
> > 
> > Try this one:
> > 
> > https://lore.kernel.org/lkml/7f55d9d0369f1ea840fab83eeb77f9f3601fee41.camel@perches.com/
> > 
> 
> It works but why not to use .+? then?
> I'm not sure that non-greedy patterns will properly handle commits like:
> $ git log --oneline | fgrep '")'
> 
> e.g. 
> commit ece2619fe8ed ("extcon: arizona: Fix flags parameter to the gpiod_get("wlf,micd-pol") call")

The only way to handle that is to use the $balanced_parens test but
it wouldn't work on Andrew's perl version 5.8

Andrew?  Do you still use perl 5.8?  It's almost 20 years old now.
Does anyone still use perl versions 5.8 or lower?

>From checkpatch:

# Using $balanced_parens, $LvalOrFunc, or $FuncArg
# requires at least perl version v5.10.0
# Any use must be runtime checked with $^V

our $balanced_parens = qr/(\((?:[^\(\)]++|(?-1))*\))/;
our $LvalOrFunc	= qr{((?:[\&\*]\s*)?$Lval)\s*($balanced_parens{0,1})\s*};
our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant|$String)};

So maybe:

> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> > > @@ -3200,20 +3200,20 @@ sub process {
> > >  			$long = 1 if ($line =~ /\bcommit\s+[0-9a-f]{41,}/i);
> > >  			$space = 0 if ($line =~ /\bcommit [0-9a-f]/i);
> > >  			$case = 0 if ($line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/);
> > > -			if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) {
> > > +			if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("(.+)"\)/i) {

So that could be:
			if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+($balanced_parens)/i

> > >  				$orig_desc = $1;
> > >  				$hasparens = 1;
> > >  			} elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i &&
> > >  				 defined $rawlines[$linenr] &&
> > > -				 $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) {
> > > +				 $rawlines[$linenr] =~ /^\s*\("(.+)"\)/) {

and

  			} elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i &&
 				 defined $rawlines[$linenr] &&
				"$line $rawlines[$linenr]" =~ /\bcommit\s+[0-9a-f]{5,}\s+($balanced_parens)/i

> > >  				$orig_desc = $1;
> > >  				$hasparens = 1;
> > > -			} elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i &&
> > > +			} elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\(".+$/i &&
> > >  				 defined $rawlines[$linenr] &&
> > > -				 $rawlines[$linenr] =~ /^\s*[^"]+"\)/) {
> > > -				$line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i;
> > > +				 $rawlines[$linenr] =~ /^\s*.+"\)/) {
> > > +				$line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("(.+)$/i;

etc...

> > >  				$orig_desc = $1;
> > > -				$rawlines[$linenr] =~ /^\s*([^"]+)"\)/;
> > > +				$rawlines[$linenr] =~ /^\s*(.+)"\)/;
> > >  				$orig_desc .= " " . $1;
> > >  				$hasparens = 1;
> > >  			}
> > 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ