Skip to contentSkip to conversation

lint-gitlink: don't use empty lower bound in .{0,8}

PATCH In review Tuomas Ahola 2 participants 3 messages Sep 7 – Sep 8 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lint-gitlink: don't use empty lower bound in .{0,8}

The regex quantifier {,n} was added in Perl 5.34.0 as a shorthand for {0,n}. That makes it too new an introduction for Git which targets Perl 5.26.0.

Even though Documentation/lint-gitlink.perl is a development helper script, let's stick to the general Perl version requirement for consistency, and use an explicit zero in .{0,8}.

---
 Documentation/lint-gitlink.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/lint-gitlink.perl +1 -1
index a92e887b4c..6a87633dd4 100755
@@ -42,7 +42,7 @@ sub report {
 while (<>) {
 	my $line = $_;
 	next if $line =~ /^\s*(ifn?def|endif)::/;
-	while ($line =~ m/(.{,8})((git[-a-z]+|scalar)\[(\d)*\])/g) {
+	while ($line =~ m/(.{0,8})((git[-a-z]+|scalar)\[(\d)*\])/g) {
 	    my $pos = pos $line;
 	    my ($macro, $target, $page, $section) = ($1, $2, $3, $4);
 		if ( $macro ne "linkgit:" ) {

base-commit: e9019fcafe0040228b8631c30f97ae1adb61bcdc

Signature · 1 line
ta/lint-gitlink-perl-regex-nit
#1 lore raw
Quoted 7 lines · Tuomas Ahola

The regex quantifier {,n} was added in Perl 5.34.0 as a shorthand for {0,n}. That makes it too new an introduction for Git which targets Perl 5.26.0.

Even though Documentation/lint-gitlink.perl is a development helper script, let's stick to the general Perl version requirement for consistency, and use an explicit zero in .{0,8}.

I am curious how you found this.

I somehow find it unlikely that you were sticking to Perl 5.26, ran "make -C Documentation lint-docs" and saw your tad old Perl complain for syntax too new.

Perl 5.26 is from May 2017 while Perl 5.34 is from May 2021 if
https://cpan.org/src/ is to be believed.

Will queue. Thanks.

Quoted 20 lines
---
 Documentation/lint-gitlink.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/lint-gitlink.perl +1 -1
index a92e887b4c..6a87633dd4 100755
@@ -42,7 +42,7 @@ sub report {
 while (<>) {
 	my $line = $_;
 	next if $line =~ /^\s*(ifn?def|endif)::/;
-	while ($line =~ m/(.{,8})((git[-a-z]+|scalar)\[(\d)*\])/g) {
+	while ($line =~ m/(.{0,8})((git[-a-z]+|scalar)\[(\d)*\])/g) {
 	    my $pos = pos $line;
 	    my ($macro, $target, $page, $section) = ($1, $2, $3, $4);
 		if ( $macro ne "linkgit:" ) {

base-commit: e9019fcafe0040228b8631c30f97ae1adb61bcdc

#2 lore raw
Quoted 10 lines · Junio C Hamano
Quoted 7 lines · Tuomas Ahola

The regex quantifier {,n} was added in Perl 5.34.0 as a shorthand for {0,n}. That makes it too new an introduction for Git which targets Perl 5.26.0.

Even though Documentation/lint-gitlink.perl is a development helper script, let's stick to the general Perl version requirement for consistency, and use an explicit zero in .{0,8}.

Quoted 5 lines

I am curious how you found this.

I somehow find it unlikely that you were sticking to Perl 5.26, ran "make -C Documentation lint-docs" and saw your tad old Perl complain for syntax too new.

Well, that's what happened (although my Perl wasn't exactly 5.26).

Quoted 5 lines

Perl 5.26 is from May 2017 while Perl 5.34 is from May 2021 if
https://cpan.org/src/ is to be believed.

Will queue. Thanks.