get_maintainer: Extend matched name characters in maintainers_in_file()
PATCH 1/1 get_maintainer: Extend matched name characters in maintainers_in_file()
Extend the regexp matching name characters to cover Unicode blocks Latin Extended-A and Extended-B.
Fixes 'scripts/get_maintainer.pl -f' for 'Documentation/devicetree/bindings/clock/apple,nco.yaml'.
---
This still excludes Greek and Cyrilic characters which should be expected in names as well. I tried to use '\p{L}' to match all Unicode letters but couldn't get it to work. Feel free understand this as bug report with an incomplete fix.
best regards,
Janne
--- scripts/get_maintainer.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/get_maintainer.pl +2 -2
@@ -442,7 +442,7 @@ sub maintainers_in_file { my $text = do { local($/) ; <$f> }; close($f); - my @poss_addr = $text =~ m$[A-Za-zÀ-ÿ\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g; + my @poss_addr = $text =~ m$[A-Za-zÀ-ɏ\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g; push(@file_emails, clean_file_emails(@poss_addr)); } }
@@ -2460,7 +2460,7 @@ sub clean_file_emails { $name = ""; } - my @nw = split(/[^A-Za-zÀ-ÿ\'\,\.\+-]/, $name); + my @nw = split(/[^A-Za-zÀ-ɏ\'\,\.\+-]/, $name); if (@nw > 2) { my $first = $nw[@nw - 3]; my $middle = $nw[@nw - 2];
Signature · 1 line
2.35.1
Quoted 9 lines · Janne Grunau
Extend the regexp matching name characters to cover Unicode blocks Latin Extended-A and Extended-B.
Fixes 'scripts/get_maintainer.pl-f' for 'Documentation/devicetree/bindings/clock/apple,nco.yaml'.Signed-off-by Janne Grunau <[email protected]>
On behalf of those not wanting to mangle our names to appease software, let me thank you.
Quoted 7 lines
This still excludes Greek and Cyrilic characters which should be expected in names as well. I tried to use '\p{L}' to match all Unicode letters but couldn't get it to work. Feel free understand this as bug report with an incomplete fix.
best regards,
Janne
Joe Perches
maintainerQuoted 5 lines · Janne Grunau
Extend the regexp matching name characters to cover Unicode blocks Latin Extended-A and Extended-B.
Fixes 'scripts/get_maintainer.pl-f' for 'Documentation/devicetree/bindings/clock/apple,nco.yaml'.
Quoted 7 lines
Signed-off-by Janne Grunau <[email protected]>---
This still excludes Greek and Cyrilic characters which should be expected in names as well. I tried to use '\p{L}' to match all Unicode letters but couldn't get it to work. Feel free understand this as bug report with an incomplete fix.
Maybe use \p{XPosixAlpha} ?
but I don't know what version of perl introduced this.
scripts/get_maintainer.pl
Quoted 1 line
scripts/get_maintainer.pl +0
-0
[]
scripts/get_maintainer.pl sub maintainers_in_file { · line 445
Quoted 6 lines
scripts/get_maintainer.pl +1
-1@@ -442,7 +442,7 @@ sub maintainers_in_file { my $text = do { local($/) ; <$f> }; close($f); - my @poss_addr = $text =~ m$[A-Za-zÀ-ÿ\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g; + my @poss_addr = $text =~ m$[A-Za-zÀ-ɏ\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g;
my @poss_addr = $text =~ m$[\p{XPosixAlpha}\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g;?
scripts/get_maintainer.pl sub clean_file_emails { · line 2463
Quoted 9 lines
scripts/get_maintainer.pl +1
-1push(@file_emails, clean_file_emails(@poss_addr)); } }@@ -2460,7 +2460,7 @@ sub clean_file_emails { $name = ""; } - my @nw = split(/[^A-Za-zÀ-ÿ\'\,\.\+-]/, $name); + my @nw = split(/[^A-Za-zÀ-ɏ\'\,\.\+-]/, $name);
Maybe here too
scripts/get_maintainer.pl sub clean_file_emails { · line 2464
Quoted 1 line
scripts/get_maintainer.pl +1
-0+ my @nw = split(/[^\p{XPosixAlpha}\'\,\.\+-]/, $name);
Dunno haven't tested. Maybe you care to test?
Joe Perches
maintainerQuoted 20 lines · Joe Perches
Quoted 5 lines · Janne Grunau
Extend the regexp matching name characters to cover Unicode blocks Latin Extended-A and Extended-B.
Fixes 'scripts/get_maintainer.pl-f' for 'Documentation/devicetree/bindings/clock/apple,nco.yaml'.Quoted 7 lines
Signed-off-by Janne Grunau <[email protected]>---
This still excludes Greek and Cyrilic characters which should be expected in names as well. I tried to use '\p{L}' to match all Unicode letters but couldn't get it to work. Feel free understand this as bug report with an incomplete fix.Maybe use \p{XPosixAlpha} ?
but I don't know what version of perl introduced this.
scripts/get_maintainer.pl
Quoted 1 line
scripts/get_maintainer.pl +0
-0[]
Quoted 8 lines
scripts/get_maintainer.pl sub maintainers_in_file { · line 445
Quoted 6 lines
scripts/get_maintainer.pl +1
-1@@ -442,7 +442,7 @@ sub maintainers_in_file { my $text = do { local($/) ; <$f> }; close($f); - my @poss_addr = $text =~ m$[A-Za-zÀ-ÿ\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g; + my @poss_addr = $text =~ m$[A-Za-zÀ-ɏ\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g;my @poss_addr = $text =~ m$[\p{XPosixAlpha}\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g;
Using variations of \p{posix} doesn't seem to work for at least perl 5.34.
\p{print} seems to work for Documentation/devicetree/bindings/clock/apple,nco.yaml, but I don't know how fragile it is.
\p{print} might be too greedy...
--- scripts/get_maintainer.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
scripts/get_maintainer.pl +3 -2
@@ -442,7 +442,7 @@ sub maintainers_in_file { my $text = do { local($/) ; <$f> }; close($f); - my @poss_addr = $text =~ m$[A-Za-zÀ-ÿ\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g; + my @poss_addr = $text =~ m$[\p{print}\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g; push(@file_emails, clean_file_emails(@poss_addr)); } }
@@ -2456,11 +2456,12 @@ sub clean_file_emails { foreach my $email (@file_emails) { $email =~ s/[\(\<\{]{0,1}([A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+)[\)\>\}]{0,1}/\<$1\>/g; my ($name, $address) = parse_email($email); + $name =~ s/^\p{space}*\p{punct}*\p{space}*//; if ($name eq '"[,\.]"') { $name = ""; } - my @nw = split(/[^A-Za-zÀ-ÿ\'\,\.\+-]/, $name); + my @nw = split(/[^\p{print}\'\,\.\+-]/, $name); if (@nw > 2) { my $first = $nw[@nw - 3]; my $middle = $nw[@nw - 2];
Quoted 30 lines · Joe Perches
Quoted 20 lines · Joe Perches
Quoted 5 lines · Janne Grunau
Extend the regexp matching name characters to cover Unicode blocks Latin Extended-A and Extended-B.
Fixes 'scripts/get_maintainer.pl-f' for 'Documentation/devicetree/bindings/clock/apple,nco.yaml'.Quoted 7 lines
Signed-off-by Janne Grunau <[email protected]>---
This still excludes Greek and Cyrilic characters which should be expected in names as well. I tried to use '\p{L}' to match all Unicode letters but couldn't get it to work. Feel free understand this as bug report with an incomplete fix.Maybe use \p{XPosixAlpha} ?
but I don't know what version of perl introduced this.
scripts/get_maintainer.pl
Quoted 1 line
scripts/get_maintainer.pl +0
-0[]
Quoted 8 lines
scripts/get_maintainer.pl sub maintainers_in_file { · line 445
Quoted 6 lines
scripts/get_maintainer.pl +1
-1@@ -442,7 +442,7 @@ sub maintainers_in_file { my $text = do { local($/) ; <$f> }; close($f); - my @poss_addr = $text =~ m$[A-Za-zÀ-ÿ\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g; + my @poss_addr = $text =~ m$[A-Za-zÀ-ɏ\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g;my @poss_addr = $text =~ m$[\p{XPosixAlpha}\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g;
Quoted 6 lines
Using variations of \p{posix} doesn't seem to work for at least perl 5.34.
\p{print} seems to work for
Documentation/devicetree/bindings/clock/apple,nco.yaml, but I don't know how fragile it is.\p{print} might be too greedy...
It is, it produces following diff (checking all files in Documentation/devicetree/bindings):
-Lubomir Rintel <[email protected]> (in file)
+"Copyright 2019,2020 Lubomir Rintel" <[email protected]> (in file)
There are multiple hits of this form. The main issue is that \p{print} includes space. That however fixes many names with 3 parts.
It still fails for "Rafał Miłecki <[email protected]>" which my change handles correctly.
I'm testing with perl 5.36
Quoted 18 lines
--- scripts/get_maintainer.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)scripts/get_maintainer.pl +1
-1@@ -442,7 +442,7 @@ sub maintainers_in_file { my $text = do { local($/) ; <$f> }; close($f); - my @poss_addr = $text =~ m$[A-Za-zÀ-ÿ\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g; + my @poss_addr = $text =~ m$[\p{print}\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g; push(@file_emails, clean_file_emails(@poss_addr)); } }
scripts/get_maintainer.pl sub clean_file_emails { · line 2459
Quoted 4 lines
scripts/get_maintainer.pl +1
-0@@ -2456,11 +2456,12 @@ sub clean_file_emails { foreach my $email (@file_emails) { $email =~ s/[\(\<\{]{0,1}([A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+)[\)\>\}]{0,1}/\<$1\>/g; my ($name, $address) = parse_email($email); + $name =~ s/^\p{space}*\p{punct}*\p{space}*//;
This change is useful independently of the name regexp as it rejects '- <[email protected]>' (yaml list items) as valid name, email combination.
Janne
Joe Perches
maintainerQuoted 7 lines · Janne Grunau
Quoted 6 lines · Joe Perches
Quoted 5 lines · Joe Perches
Quoted 4 lines · Janne Grunau
Extend the regexp matching name characters to cover Unicode blocks Latin Extended-A and Extended-B.
Fixes 'scripts/get_maintainer.pl-f' for 'Documentation/devicetree/bindings/clock/apple,nco.yaml'.
[]
Quoted 18 lines
Quoted 11 lines
Quoted 10 lines
scripts/get_maintainer.pl
Quoted 1 line
scripts/get_maintainer.pl +0
-0[]
scripts/get_maintainer.pl sub maintainers_in_file { · line 445
Quoted 6 lines
scripts/get_maintainer.pl +1
-1@@ -442,7 +442,7 @@ sub maintainers_in_file { my $text = do { local($/) ; <$f> }; close($f); - my @poss_addr = $text =~ m$[A-Za-zÀ-ÿ\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g; + my @poss_addr = $text =~ m$[A-Za-zÀ-ɏ\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g;my @poss_addr = $text =~ m$[\p{XPosixAlpha}\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g;Quoted 6 lines
Using variations of \p{posix} doesn't seem to work for at least perl 5.34.
\p{print} seems to work for
Documentation/devicetree/bindings/clock/apple,nco.yaml, but I don't know how fragile it is.\p{print} might be too greedy...
Quoted 7 lines
It is, it produces following diff (checking all files in
Documentation/devicetree/bindings):
-Lubomir Rintel <[email protected]> (in file)
+"Copyright 2019,2020 Lubomir Rintel" <[email protected]> (in file)There are multiple hits of this form. The main issue is that \p{print} includes space. That however fixes many names with 3 parts.
right
Quoted 1 line
scripts/get_maintainer.pl
Quoted 1 line
scripts/get_maintainer.pl +0
-0
[]
Quoted 8 lines
scripts/get_maintainer.pl sub clean_file_emails { · line 2459
Quoted 5 lines
scripts/get_maintainer.pl +1
-0@@ -2456,11 +2456,12 @@ sub clean_file_emails { foreach my $email (@file_emails) { $email =~ s/[\(\<\{]{0,1}([A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+)[\)\>\}]{0,1}/\<$1\>/g; my ($name, $address) = parse_email($email); + $name =~ s/^\p{space}*\p{punct}*\p{space}*//;This change is useful independently of the name regexp as it rejects '- <[email protected]>' (yaml list items) as valid name, email combination.
Good. The below might be a bit better too:
$name =~ s/(?:\p{space}|\p{punct})*//;