Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #61683 > unrolled thread

Bug#905116: scripts/kernel-doc: Unescaped left brace in regex is deprecated

Started byNiko Tyni <ntyni@debian.org>
First post2018-07-31 13:00 +0200
Last post2018-08-28 17:10 +0200
Articles 9 — 4 participants

Back to article view | Back to linux.debian.kernel


Contents

  Bug#905116: scripts/kernel-doc: Unescaped left brace in regex is deprecated Niko Tyni <ntyni@debian.org> - 2018-07-31 13:00 +0200
    Bug#905116: [PATCH] scripts/kernel-doc: Escape all literal braces in regexes Ben Hutchings <ben@decadent.org.uk> - 2018-08-05 18:30 +0200
    Bug#905116: [PATCH v2] scripts/kernel-doc: Escape all literal braces in regexes Ben Hutchings <ben@decadent.org.uk> - 2018-08-05 18:50 +0200
      Bug#905116: [PATCH v2] scripts/kernel-doc: Escape all literal braces in regexes Jonathan Corbet <corbet@lwn.net> - 2018-08-06 15:30 +0200
        Bug#905116: [PATCH v2] scripts/kernel-doc: Escape all literal braces in regexes Ben Hutchings <ben@decadent.org.uk> - 2018-08-06 17:50 +0200
      Bug#905116: [PATCH v2] scripts/kernel-doc: Escape all literal braces in regexes Jonathan Corbet <corbet@lwn.net> - 2018-08-06 21:40 +0200
    Bug#905116: marked as done (scripts/kernel-doc: Unescaped left  brace in regex is deprecated) "Debian Bug Tracking System" <owner@bugs.debian.org> - 2018-08-28 10:20 +0200
    Bug#905116: marked as done (scripts/kernel-doc: Unescaped left  brace in regex is deprecated) "Debian Bug Tracking System" <owner@bugs.debian.org> - 2018-08-28 10:20 +0200
    Bug#905116: marked as done (scripts/kernel-doc: Unescaped left  brace in regex is deprecated) "Debian Bug Tracking System" <owner@bugs.debian.org> - 2018-08-28 17:10 +0200

#61683 — Bug#905116: scripts/kernel-doc: Unescaped left brace in regex is deprecated

FromNiko Tyni <ntyni@debian.org>
Date2018-07-31 13:00 +0200
SubjectBug#905116: scripts/kernel-doc: Unescaped left brace in regex is deprecated
Message-ID<whAxH-3DS-3@gated-at.bofh.it>
Source: linux
Version: 4.17.8-1
Severity: minor
User: debian-perl@lists.debian.org
Usertags: perl-5.28-transition

While test rebuilding the archive against Perl 5.28 (currently in
experimental), we noticed these warnings in the build log of this package:

 Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.32), passed through in regex; marked by <-- HERE in m/({ <-- HERE )/ at ./scripts/kernel-doc line 1179.
 Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.32), passed through in regex; marked by <-- HERE in m/({ <-- HERE [^\{\}]*})/ at ./scripts/kernel-doc line 1155.

-- 
Niko Tyni   ntyni@debian.org

[toc] | [next] | [standalone]


#61735 — Bug#905116: [PATCH] scripts/kernel-doc: Escape all literal braces in regexes

FromBen Hutchings <ben@decadent.org.uk>
Date2018-08-05 18:30 +0200
SubjectBug#905116: [PATCH] scripts/kernel-doc: Escape all literal braces in regexes
Message-ID<wju4O-8jl-7@gated-at.bofh.it>
In reply to#61683

[Multipart message — attachments visible in raw view] — view raw

Braces are usually metacharacters in regexes, used to specify a
number of repetitions or as part of an escape sequence.  If this
interpretation is not possible then Perl currently treats them
as literal characters.

Perl 5.28 has deprecated the literal interpretation of left braces,
and Perl 5.32 will remove it (resulting in a fatal error).

Escape all left braces that are treated as literal characters.  Also
escape literal right braces, for consistency and to avoid confusing
bracket-matching in text editors.

References: https://bugs.debian.org/905116
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
I tested that the output of "make xmldocs" is identical before and
after this change, whether using Perl 5.26 or 5.28.

Ben.

 scripts/kernel-doc | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 0057d8eafcc1..8f0f508a78e9 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1062,7 +1062,7 @@ sub dump_struct($$) {
     my $x = shift;
     my $file = shift;
 
-    if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) {
+    if ($x =~ /(struct|union)\s+(\w+)\s*\{(.*)\}/) {
 	my $decl_type = $1;
 	$declaration_name = $2;
 	my $members = $3;
@@ -1148,20 +1148,20 @@ sub dump_struct($$) {
 				}
 			}
 		}
-		$members =~ s/(struct|union)([^\{\};]+)\{([^\{\}]*)}([^\{\}\;]*)\;/$newmember/;
+		$members =~ s/(struct|union)([^\{\};]+)\{([^\{\}]*)\}([^\{\}\;]*)\;/$newmember/;
 	}
 
 	# Ignore other nested elements, like enums
-	$members =~ s/({[^\{\}]*})//g;
+	$members =~ s/(\{[^\{\}]*\})//g;
 
 	create_parameterlist($members, ';', $file, $declaration_name);
 	check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual);
 
 	# Adjust declaration for better display
-	$declaration =~ s/([{;])/$1\n/g;
-	$declaration =~ s/}\s+;/};/g;
+	$declaration =~ s/([\{;])/$1\n/g;
+	$declaration =~ s/\}\s+;/};/g;
 	# Better handle inlined enums
-	do {} while ($declaration =~ s/(enum\s+{[^}]+),([^\n])/$1,\n$2/);
+	do {} while ($declaration =~ s/(enum\s+\{[^\}]+),([^\n])/$1,\n$2/);
 
 	my @def_args = split /\n/, $declaration;
 	my $level = 1;
@@ -1171,12 +1171,12 @@ sub dump_struct($$) {
 		$clause =~ s/\s+$//;
 		$clause =~ s/\s+/ /;
 		next if (!$clause);
-		$level-- if ($clause =~ m/(})/ && $level > 1);
+		$level-- if ($clause =~ m/(\})/ && $level > 1);
 		if (!($clause =~ m/^\s*#/)) {
 			$declaration .= "\t" x $level;
 		}
 		$declaration .= "\t" . $clause . "\n";
-		$level++ if ($clause =~ m/({)/ && !($clause =~m/}/));
+		$level++ if ($clause =~ m/(\{)/ && !($clause =~m/\}/));
 	}
 	output_declaration($declaration_name,
 			   'struct',
@@ -1244,7 +1244,7 @@ sub dump_enum($$) {
     # strip #define macros inside enums
     $x =~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos;
 
-    if ($x =~ /enum\s+(\w+)\s*{(.*)}/) {
+    if ($x =~ /enum\s+(\w+)\s*\{(.*)\}/) {
 	$declaration_name = $1;
 	my $members = $2;
 	my %_members;
@@ -1785,7 +1785,7 @@ sub process_proto_type($$) {
     }
 
     while (1) {
-	if ( $x =~ /([^{};]*)([{};])(.*)/ ) {
+	if ( $x =~ /([^\{\};]*)([\{\};])(.*)/ ) {
             if( length $prototype ) {
                 $prototype .= " "
             }

[toc] | [prev] | [next] | [standalone]


#61738 — Bug#905116: [PATCH v2] scripts/kernel-doc: Escape all literal braces in regexes

FromBen Hutchings <ben@decadent.org.uk>
Date2018-08-05 18:50 +0200
SubjectBug#905116: [PATCH v2] scripts/kernel-doc: Escape all literal braces in regexes
Message-ID<wjuo9-8qA-5@gated-at.bofh.it>
In reply to#61683

[Multipart message — attachments visible in raw view] — view raw

Commit 720ac2ef479d ("PATCH scripts/kernel-doc") fixed the two
instances of literal braces that Perl 5.28 warns about, but there are
still more than it doesn't warn about.

Escape all left braces that are treated as literal characters.  Also
escape literal right braces, for consistency and to avoid confusing
bracket-matching in text editors.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
v2: Rebase on top of commit 720ac2ef479d; reword accordingly

 scripts/kernel-doc | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 31a34ced55a3..8f0f508a78e9 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1062,7 +1062,7 @@ sub dump_struct($$) {
     my $x = shift;
     my $file = shift;
 
-    if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) {
+    if ($x =~ /(struct|union)\s+(\w+)\s*\{(.*)\}/) {
 	my $decl_type = $1;
 	$declaration_name = $2;
 	my $members = $3;
@@ -1148,20 +1148,20 @@ sub dump_struct($$) {
 				}
 			}
 		}
-		$members =~ s/(struct|union)([^\{\};]+)\{([^\{\}]*)}([^\{\}\;]*)\;/$newmember/;
+		$members =~ s/(struct|union)([^\{\};]+)\{([^\{\}]*)\}([^\{\}\;]*)\;/$newmember/;
 	}
 
 	# Ignore other nested elements, like enums
-	$members =~ s/(\{[^\{\}]*})//g;
+	$members =~ s/(\{[^\{\}]*\})//g;
 
 	create_parameterlist($members, ';', $file, $declaration_name);
 	check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual);
 
 	# Adjust declaration for better display
-	$declaration =~ s/([{;])/$1\n/g;
-	$declaration =~ s/}\s+;/};/g;
+	$declaration =~ s/([\{;])/$1\n/g;
+	$declaration =~ s/\}\s+;/};/g;
 	# Better handle inlined enums
-	do {} while ($declaration =~ s/(enum\s+{[^}]+),([^\n])/$1,\n$2/);
+	do {} while ($declaration =~ s/(enum\s+\{[^\}]+),([^\n])/$1,\n$2/);
 
 	my @def_args = split /\n/, $declaration;
 	my $level = 1;
@@ -1171,12 +1171,12 @@ sub dump_struct($$) {
 		$clause =~ s/\s+$//;
 		$clause =~ s/\s+/ /;
 		next if (!$clause);
-		$level-- if ($clause =~ m/(})/ && $level > 1);
+		$level-- if ($clause =~ m/(\})/ && $level > 1);
 		if (!($clause =~ m/^\s*#/)) {
 			$declaration .= "\t" x $level;
 		}
 		$declaration .= "\t" . $clause . "\n";
-		$level++ if ($clause =~ m/(\{)/ && !($clause =~m/}/));
+		$level++ if ($clause =~ m/(\{)/ && !($clause =~m/\}/));
 	}
 	output_declaration($declaration_name,
 			   'struct',
@@ -1244,7 +1244,7 @@ sub dump_enum($$) {
     # strip #define macros inside enums
     $x =~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos;
 
-    if ($x =~ /enum\s+(\w+)\s*{(.*)}/) {
+    if ($x =~ /enum\s+(\w+)\s*\{(.*)\}/) {
 	$declaration_name = $1;
 	my $members = $2;
 	my %_members;
@@ -1785,7 +1785,7 @@ sub process_proto_type($$) {
     }
 
     while (1) {
-	if ( $x =~ /([^{};]*)([{};])(.*)/ ) {
+	if ( $x =~ /([^\{\};]*)([\{\};])(.*)/ ) {
             if( length $prototype ) {
                 $prototype .= " "
             }

[toc] | [prev] | [next] | [standalone]


#61745 — Bug#905116: [PATCH v2] scripts/kernel-doc: Escape all literal braces in regexes

FromJonathan Corbet <corbet@lwn.net>
Date2018-08-06 15:30 +0200
SubjectBug#905116: [PATCH v2] scripts/kernel-doc: Escape all literal braces in regexes
Message-ID<wjNK9-3Of-7@gated-at.bofh.it>
In reply to#61738
On Sun, 5 Aug 2018 17:41:09 +0100
Ben Hutchings <ben@decadent.org.uk> wrote:

> Commit 720ac2ef479d ("PATCH scripts/kernel-doc") fixed the two
> instances of literal braces that Perl 5.28 warns about, but there are
> still more than it doesn't warn about.

So where can I find this commit of which you speak?  I can't find it in
mainline, -next, or -stable...  

The patch looks good, I'd like to get it in this coming merge window if
possible.

Thanks,

jon

[toc] | [prev] | [next] | [standalone]


#61748 — Bug#905116: [PATCH v2] scripts/kernel-doc: Escape all literal braces in regexes

FromBen Hutchings <ben@decadent.org.uk>
Date2018-08-06 17:50 +0200
SubjectBug#905116: [PATCH v2] scripts/kernel-doc: Escape all literal braces in regexes
Message-ID<wjPVD-55O-1@gated-at.bofh.it>
In reply to#61745

[Multipart message — attachments visible in raw view] — view raw

On Mon, 2018-08-06 at 07:14 -0600, Jonathan Corbet wrote:
> On Sun, 5 Aug 2018 17:41:09 +0100
> Ben Hutchings <ben@decadent.org.uk> wrote:
> 
> > Commit 720ac2ef479d ("PATCH scripts/kernel-doc") fixed the two
> > instances of literal braces that Perl 5.28 warns about, but there are
> > still more than it doesn't warn about.
> 
> So where can I find this commit of which you speak?  I can't find it in
> mainline, -next, or -stable...  
> 
> The patch looks good, I'd like to get it in this coming merge window if
> possible.

Sorry, that was the wrong commit hash.  I mean commit 701b3a3c0ac4.

Ben.

-- 
Ben Hutchings
Larkinson's Law: All laws are basically false.

[toc] | [prev] | [next] | [standalone]


#61753 — Bug#905116: [PATCH v2] scripts/kernel-doc: Escape all literal braces in regexes

FromJonathan Corbet <corbet@lwn.net>
Date2018-08-06 21:40 +0200
SubjectBug#905116: [PATCH v2] scripts/kernel-doc: Escape all literal braces in regexes
Message-ID<wjTwd-7v9-1@gated-at.bofh.it>
In reply to#61738
On Sun, 5 Aug 2018 17:41:09 +0100
Ben Hutchings <ben@decadent.org.uk> wrote:

> Commit 720ac2ef479d ("PATCH scripts/kernel-doc") fixed the two
> instances of literal braces that Perl 5.28 warns about, but there are
> still more than it doesn't warn about.
> 
> Escape all left braces that are treated as literal characters.  Also
> escape literal right braces, for consistency and to avoid confusing
> bracket-matching in text editors.
> 
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

Applied (with the commit hash corrected), thanks.

jon

[toc] | [prev] | [next] | [standalone]


#61927 — Bug#905116: marked as done (scripts/kernel-doc: Unescaped left brace in regex is deprecated)

From"Debian Bug Tracking System" <owner@bugs.debian.org>
Date2018-08-28 10:20 +0200
SubjectBug#905116: marked as done (scripts/kernel-doc: Unescaped left brace in regex is deprecated)
Message-ID<wrHoe-MO-7@gated-at.bofh.it>
In reply to#61683

[Multipart message — attachments visible in raw view] — view raw

Your message dated Tue, 28 Aug 2018 08:10:23 +0000
with message-id <E1fuZ4x-000Dq7-Uj@fasolo.debian.org>
and subject line Bug#905116: fixed in linux-signed-arm64 4.18.5+1~exp1
has caused the Debian Bug report #905116,
regarding scripts/kernel-doc: Unescaped left brace in regex is deprecated
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
905116: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=905116
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems

[toc] | [prev] | [next] | [standalone]


#61928 — Bug#905116: marked as done (scripts/kernel-doc: Unescaped left brace in regex is deprecated)

From"Debian Bug Tracking System" <owner@bugs.debian.org>
Date2018-08-28 10:20 +0200
SubjectBug#905116: marked as done (scripts/kernel-doc: Unescaped left brace in regex is deprecated)
Message-ID<wrHoe-MO-17@gated-at.bofh.it>
In reply to#61683

[Multipart message — attachments visible in raw view] — view raw

Your message dated Tue, 28 Aug 2018 08:10:23 +0000
with message-id <E1fuZ4x-000DoO-Fm@fasolo.debian.org>
and subject line Bug#905116: fixed in linux-signed-amd64 4.18.5+1~exp1
has caused the Debian Bug report #905116,
regarding scripts/kernel-doc: Unescaped left brace in regex is deprecated
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
905116: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=905116
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems

[toc] | [prev] | [next] | [standalone]


#61939 — Bug#905116: marked as done (scripts/kernel-doc: Unescaped left brace in regex is deprecated)

From"Debian Bug Tracking System" <owner@bugs.debian.org>
Date2018-08-28 17:10 +0200
SubjectBug#905116: marked as done (scripts/kernel-doc: Unescaped left brace in regex is deprecated)
Message-ID<wrNN0-4zF-23@gated-at.bofh.it>
In reply to#61683

[Multipart message — attachments visible in raw view] — view raw

Your message dated Tue, 28 Aug 2018 15:00:09 +0000
with message-id <E1fufTV-000BeM-IU@fasolo.debian.org>
and subject line Bug#905116: fixed in linux-signed-i386 4.18.5+1~exp1
has caused the Debian Bug report #905116,
regarding scripts/kernel-doc: Unescaped left brace in regex is deprecated
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
905116: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=905116
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.kernel


csiph-web