Skip to contentSkip to conversation

Revert: checkpatch: check trace-events code style

PATCH In review Alex Williamson 3 participants 6 messages Oct 3, 2017 – Oct 4, 2017 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert: checkpatch: check trace-events code style

Commit c3e5875afc0f ("checkpatch: check trace-events code style") introduces a regression as reported:

https://lists.gnu.org/archive/html/qemu-devel/2017-08/msg05820.html

Bareword found where operator expected at ./scripts/checkpatch.pl line 1350, near "s/($hex[.:\/ ])+$hex//gr" syntax error at ./scripts/checkpatch.pl line 1350, near "s/($hex[.:\/ ])+$hex//gr" Execution of ./scripts/checkpatch.pl aborted due to compilation errors.

$ perl -v

This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

As no fix or discussion has resulted, revert the original patch.

Cc Vladimir Sementsov-Ogievskiy <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Fixes c3e5875afc0f ("checkpatch: check trace-events code style")
---
 scripts/checkpatch.pl |   19 -------------------
 1 file changed, 19 deletions(-)
scripts/checkpatch.pl +0 -19
index 3c0a28e644aa..f7e785d12a49 100755
@@ -1422,25 +1422,6 @@ sub process {
 			$rpt_cleaners = 1;
 		}
 
-# checks for trace-events files
-		if ($realfile =~ /trace-events$/ && $line =~ /^\+/) {
-			if ($rawline =~ /%[-+ 0]*#/) {
-				ERROR("Don't use '#' flag of printf format ('%#') in " .
-				      "trace-events, use '0x' prefix instead\n" . $herecurr);
-			} else {
-				my $hex =
-					qr/%[-+ *.0-9]*([hljztL]|ll|hh)?(x|X|"\s*PRI[xX][^"]*"?)/;
-
-				# don't consider groups splitted by [.:/ ], like 2A.20:12ab
-				my $tmpline = $rawline =~ s/($hex[.:\/ ])+$hex//gr;
-
-				if ($tmpline =~ /(?<!0x)$hex/) {
-					ERROR("Hex numbers must be prefixed with '0x'\n" .
-					      $herecurr);
-				}
-			}
-		}
-
 # check we are in a valid source file if not then ignore this hunk
 		next if ($realfile !~ /\.(h|c|cpp|s|S|pl|py|sh)$/);
 
#1 lore raw
Quoted 9 lines · Alex Williamson

Commit c3e5875afc0f ("checkpatch: check trace-events code style") introduces a regression as reported:

https://lists.gnu.org/archive/html/qemu-devel/2017-08/msg05820.html

Bareword found where operator expected at ./scripts/checkpatch.pl line 1350, near "s/($hex[.:\/ ])+$hex//gr" syntax error at ./scripts/checkpatch.pl line 1350, near "s/($hex[.:\/ ])+$hex//gr" Execution of ./scripts/checkpatch.pl aborted due to compilation errors.

Quoted 5 lines
$ perl -v

This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

As no fix or discussion has resulted, revert the original patch.

However, this revert will be a regression too - checkpatch will not check that thing more.

Quoted 40 lines
Cc Vladimir Sementsov-Ogievskiy <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Fixes c3e5875afc0f ("checkpatch: check trace-events code style")
---
  scripts/checkpatch.pl |   19 -------------------
  1 file changed, 19 deletions(-)
scripts/checkpatch.pl +0 -19
index 3c0a28e644aa..f7e785d12a49 100755
@@ -1422,25 +1422,6 @@ sub process {
  			$rpt_cleaners = 1;
  		}
 
-# checks for trace-events files
-		if ($realfile =~ /trace-events$/ && $line =~ /^\+/) {
-			if ($rawline =~ /%[-+ 0]*#/) {
-				ERROR("Don't use '#' flag of printf format ('%#') in " .
-				      "trace-events, use '0x' prefix instead\n" . $herecurr);
-			} else {
-				my $hex =
-					qr/%[-+ *.0-9]*([hljztL]|ll|hh)?(x|X|"\s*PRI[xX][^"]*"?)/;
-
-				# don't consider groups splitted by [.:/ ], like 2A.20:12ab
-				my $tmpline = $rawline =~ s/($hex[.:\/ ])+$hex//gr;
-
-				if ($tmpline =~ /(?<!0x)$hex/) {
-					ERROR("Hex numbers must be prefixed with '0x'\n" .
-					      $herecurr);
-				}
-			}
-		}
-
  # check we are in a valid source file if not then ignore this hunk
  		next if ($realfile !~ /\.(h|c|cpp|s|S|pl|py|sh)$/);
 
Signature · 2 lines
Best regards,
Vladimir
#2 lore raw
In reply to Alex Williamson
Quoted 5 lines · Alex Williamson

Commit c3e5875afc0f ("checkpatch: check trace-events code style") introduces a regression as reported:

https://lists.gnu.org/archive/html/qemu-devel/2017-08/msg05820.html

Quoted 7 lines

Bareword found where operator expected at ./scripts/checkpatch.pl line 1350, near "s/($hex[.:\/ ])+$hex//gr" syntax error at ./scripts/checkpatch.pl line 1350, near "s/($hex[.:\/ ])+$hex//gr" Execution of ./scripts/checkpatch.pl aborted due to compilation errors.

$ perl -v

This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

v5.10.1 is 8 years old.
most possibly the error relates to  /r modifier, which was added int perl 5.14, so, possible solution would be

@@ -1432,7 +1432,8 @@ sub process {
                     qr/%[-+ *.0-9]*([hljztL]|ll|hh)?(x|X|"\s*PRI[xX][^"]*"?)/;

                 # don't consider groups splitted by [.:/ ], like 2A.20:12ab -                my $tmpline = $rawline =~ s/($hex[.:\/ ])+$hex//gr; +                my $tmpline = $rawline;
+                my $tmpline =~ s/($hex[.:\/ ])+$hex//g;

                 if ($tmpline =~ /(?<!0x)$hex/) {
                     ERROR("Hex numbers must be prefixed with '0x'\n" .

Quoted 2 lines

As no fix or discussion has resulted, revert the original patch.

Sorry for no answer on your report

Quoted 40 lines
Cc Vladimir Sementsov-Ogievskiy <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Fixes c3e5875afc0f ("checkpatch: check trace-events code style")
---
  scripts/checkpatch.pl |   19 -------------------
  1 file changed, 19 deletions(-)
scripts/checkpatch.pl +0 -19
index 3c0a28e644aa..f7e785d12a49 100755
@@ -1422,25 +1422,6 @@ sub process {
  			$rpt_cleaners = 1;
  		}
 
-# checks for trace-events files
-		if ($realfile =~ /trace-events$/ && $line =~ /^\+/) {
-			if ($rawline =~ /%[-+ 0]*#/) {
-				ERROR("Don't use '#' flag of printf format ('%#') in " .
-				      "trace-events, use '0x' prefix instead\n" . $herecurr);
-			} else {
-				my $hex =
-					qr/%[-+ *.0-9]*([hljztL]|ll|hh)?(x|X|"\s*PRI[xX][^"]*"?)/;
-
-				# don't consider groups splitted by [.:/ ], like 2A.20:12ab
-				my $tmpline = $rawline =~ s/($hex[.:\/ ])+$hex//gr;
-
-				if ($tmpline =~ /(?<!0x)$hex/) {
-					ERROR("Hex numbers must be prefixed with '0x'\n" .
-					      $herecurr);
-				}
-			}
-		}
-
  # check we are in a valid source file if not then ignore this hunk
  		next if ($realfile !~ /\.(h|c|cpp|s|S|pl|py|sh)$/);
 
Signature · 2 lines
Best regards,
Vladimir
#3 lore raw
Quoted 22 lines · Vladimir Sementsov-Ogievskiy
Quoted 5 lines · Alex Williamson

Commit c3e5875afc0f ("checkpatch: check trace-events code style") introduces a regression as reported:

https://lists.gnu.org/archive/html/qemu-devel/2017-08/msg05820.html

Quoted 7 lines

Bareword found where operator expected at ./scripts/checkpatch.pl line 1350, near "s/($hex[.:\/ ])+$hex//gr" syntax error at ./scripts/checkpatch.pl line 1350, near "s/($hex[.:\/ ])+$hex//gr" Execution of ./scripts/checkpatch.pl aborted due to compilation errors.

$ perl -v

This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

v5.10.1 is 8 years old.
most possibly the error relates to  /r modifier, which was added int perl 5.14, so, possible solution would be

(quoted diff) +0 -0
@@ -1432,7 +1432,8 @@ sub process {

                     qr/%[-+ *.0-9]*([hljztL]|ll|hh)?(x|X|"\s*PRI[xX][^"]*"?)/;

Quoted 7 lines

                 # don't consider groups splitted by [.:/ ], like 2A.20:12ab -                my $tmpline = $rawline =~ s/($hex[.:\/ ])+$hex//gr; +                my $tmpline = $rawline;
+                my $tmpline =~ s/($hex[.:\/ ])+$hex//g;

                 if ($tmpline =~ /(?<!0x)$hex/) {
                     ERROR("Hex numbers must be prefixed with '0x'\n" .

Yes, that fixes the error when run on a rhel6 vintage Perl.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#4 lore raw
In reply to Vladimir Sementsov-Ogievskiy
Quoted 28 lines · On Wed, 4 Oct 2017 12:59:04 +0300 Vladimir Sementsov-Ogievskiy…
Quoted 5 lines · Alex Williamson

Commit c3e5875afc0f ("checkpatch: check trace-events code style") introduces a regression as reported:

https://lists.gnu.org/archive/html/qemu-devel/2017-08/msg05820.html

Quoted 7 lines

Bareword found where operator expected at ./scripts/checkpatch.pl line 1350, near "s/($hex[.:\/ ])+$hex//gr" syntax error at ./scripts/checkpatch.pl line 1350, near "s/($hex[.:\/ ])+$hex//gr" Execution of ./scripts/checkpatch.pl aborted due to compilation errors.

$ perl -v

This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

v5.10.1 is 8 years old.
most possibly the error relates to  /r modifier, which was added int perl 5.14, so, possible solution would be

(quoted diff) +0 -0
@@ -1432,7 +1432,8 @@ sub process {
                      qr/%[-+ 
 *.0-9]*([hljztL]|ll|hh)?(x|X|"\s*PRI[xX][^"]*"?)/;
 
                  # don't consider groups splitted by [.:/ ], like 

2A.20:12ab
-                my $tmpline = $rawline =~ s/($hex[.:\/ ])+$hex//gr; +                my $tmpline = $rawline;
+                my $tmpline =~ s/($hex[.:\/ ])+$hex//g;

Quoted 2 lines

                 if ($tmpline =~ /(?<!0x)$hex/) { ERROR("Hex numbers must be prefixed with '0x'\n" .

Yes, that fixes it.

Quoted 4 lines
Quoted 2 lines

As no fix or discussion has resulted, revert the original patch.

Sorry for no answer on your report

No worries, this seems to have gotten the job done. Please post the patch above and I withdraw my revert. Thanks,

Alex

Quoted 42 lines
Quoted 40 lines
Cc Vladimir Sementsov-Ogievskiy <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Fixes c3e5875afc0f ("checkpatch: check trace-events code style")
---
  scripts/checkpatch.pl |   19 -------------------
  1 file changed, 19 deletions(-)
scripts/checkpatch.pl +0 -19
index 3c0a28e644aa..f7e785d12a49 100755
@@ -1422,25 +1422,6 @@ sub process {
  			$rpt_cleaners = 1;
  		}
 
-# checks for trace-events files
-		if ($realfile =~ /trace-events$/ && $line =~ /^\+/) {
-			if ($rawline =~ /%[-+ 0]*#/) {
-				ERROR("Don't use '#' flag of printf format ('%#') in " .
-				      "trace-events, use '0x' prefix instead\n" . $herecurr);
-			} else {
-				my $hex =
-					qr/%[-+ *.0-9]*([hljztL]|ll|hh)?(x|X|"\s*PRI[xX][^"]*"?)/;
-
-				# don't consider groups splitted by [.:/ ], like 2A.20:12ab
-				my $tmpline = $rawline =~ s/($hex[.:\/ ])+$hex//gr;
-
-				if ($tmpline =~ /(?<!0x)$hex/) {
-					ERROR("Hex numbers must be prefixed with '0x'\n" .
-					      $herecurr);
-				}
-			}
-		}
-
  # check we are in a valid source file if not then ignore this hunk
  		next if ($realfile !~ /\.(h|c|cpp|s|S|pl|py|sh)$/);
 
#5 lore raw
Quoted 24 lines · Alex Williamson
Quoted 21 lines · On Wed, 4 Oct 2017 12:59:04 +0300 Vladimir Sementsov-Ogievskiy…
Quoted 5 lines · Alex Williamson

Commit c3e5875afc0f ("checkpatch: check trace-events code style") introduces a regression as reported:

https://lists.gnu.org/archive/html/qemu-devel/2017-08/msg05820.html

Quoted 7 lines

Bareword found where operator expected at ./scripts/checkpatch.pl line 1350, near "s/($hex[.:\/ ])+$hex//gr" syntax error at ./scripts/checkpatch.pl line 1350, near "s/($hex[.:\/ ])+$hex//gr" Execution of ./scripts/checkpatch.pl aborted due to compilation errors.

$ perl -v

This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

v5.10.1 is 8 years old.
most possibly the error relates to  /r modifier, which was added int perl 5.14, so, possible solution would be

(quoted diff) +0 -0
@@ -1432,7 +1432,8 @@ sub process {
                       qr/%[-+
 *.0-9]*([hljztL]|ll|hh)?(x|X|"\s*PRI[xX][^"]*"?)/;
 
Quoted 5 lines
Quoted 5 lines
(quoted diff) +0 -0
                   # don't consider groups splitted by [.:/ ], like

2A.20:12ab
-                my $tmpline = $rawline =~ s/($hex[.:\/ ])+$hex//gr; +                my $tmpline = $rawline;
+                my $tmpline =~ s/($hex[.:\/ ])+$hex//g;

of course, last line should be without "my". I've sent a fixed patch.

Quoted 52 lines
Quoted 3 lines

                 if ($tmpline =~ /(?<!0x)$hex/) { ERROR("Hex numbers must be prefixed with '0x'\n" .

Yes, that fixes it.

Quoted 2 lines
Quoted 1 line

As no fix or discussion has resulted, revert the original patch.

Sorry for no answer on your report

No worries, this seems to have gotten the job done. Please post the patch above and I withdraw my revert. Thanks,

Alex

Quoted 40 lines
Quoted 39 lines
Cc Vladimir Sementsov-Ogievskiy <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Fixes c3e5875afc0f ("checkpatch: check trace-events code style")
---
   scripts/checkpatch.pl |   19 -------------------
   1 file changed, 19 deletions(-)
scripts/checkpatch.pl +0 -19
index 3c0a28e644aa..f7e785d12a49 100755
@@ -1422,25 +1422,6 @@ sub process {
   			$rpt_cleaners = 1;
   		}
 
-# checks for trace-events files
-		if ($realfile =~ /trace-events$/ && $line =~ /^\+/) {
-			if ($rawline =~ /%[-+ 0]*#/) {
-				ERROR("Don't use '#' flag of printf format ('%#') in " .
-				      "trace-events, use '0x' prefix instead\n" . $herecurr);
-			} else {
-				my $hex =
-					qr/%[-+ *.0-9]*([hljztL]|ll|hh)?(x|X|"\s*PRI[xX][^"]*"?)/;
-
-				# don't consider groups splitted by [.:/ ], like 2A.20:12ab
-				my $tmpline = $rawline =~ s/($hex[.:\/ ])+$hex//gr;
-
-				if ($tmpline =~ /(?<!0x)$hex/) {
-					ERROR("Hex numbers must be prefixed with '0x'\n" .
-					      $herecurr);
-				}
-			}
-		}
-
   # check we are in a valid source file if not then ignore this hunk
   		next if ($realfile !~ /\.(h|c|cpp|s|S|pl|py|sh)$/);
 
Signature · 2 lines
Best regards,
Vladimir