Skip to contentSkip to conversation

Fix perl error "unescaped left brace in regex" for paranoid update hook

PATCH Superseded Dominic Winkler via GitGitGadget 2 participants 6 messages Sep 10, 2019 – Sep 12, 2019

lore
Share & tools
lore
#0 lore raw

cover Fix perl error "unescaped left brace in regex" for paranoid update hook

A literal "{" should now be escaped in a pattern starting from perl versions

Quoted 1 line

= v5.26. In perl v5.22, using a literal { in a regular expression was

deprecated, and will emit a warning if it isn't escaped: {. In v5.26, this won't just warn, it'll cause a syntax error.

(see https://metacpan.org/pod/release/RJBS/perl-5.22.0/pod/perldelta.pod)

Dominic Winkler (1):
Fix perl error "unescaped left brace in regex" for paranoid update
hook

 contrib/hooks/update-paranoid | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

base-commit: 5fa0f5238b0cd46cfe7f6fa76c3f526ea98148d9
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-335%2Fflexarts%2Fmaint-update-paranoid-perlv5.26-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-335/flexarts/maint-update-paranoid-perlv5.26-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/335

Signature · 1 line
gitgitgadget
#1 lore raw

PATCH 1/1 Fix perl error "unescaped left brace in regex" for paranoid update hook

From: Dominic Winkler <[email protected]>

A literal "{" should now be escaped in a pattern starting from perl versions >= v5.26. In perl v5.22, using a literal { in a regular expression was deprecated, and will emit a warning if it isn't escaped: \{. In v5.26, this won't just warn, it'll cause a syntax error.

(see https://metacpan.org/pod/release/RJBS/perl-5.22.0/pod/perldelta.pod)

---
 contrib/hooks/update-paranoid | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
contrib/hooks/update-paranoid +2 -2
index d18b317b2f..fc0a242a4e 100755
@@ -302,13 +302,13 @@ $op = 'U' if ($op eq 'R'
 
 RULE:
 	foreach (@$rules) {
-		while (/\${user\.([a-z][a-zA-Z0-9]+)}/) {
+		while (/\$\{user\.([a-z][a-zA-Z0-9]+)}/) {
 			my $k = lc $1;
 			my $v = $data{"user.$k"};
 			next RULE unless defined $v;
 			next RULE if @$v != 1;
 			next RULE unless defined $v->[0];
-			s/\${user\.$k}/$v->[0]/g;
+			s/\$\{user\.$k}/$v->[0]/g;
 		}
 
 		if (/^([AMD ]+)\s+of\s+([^\s]+)\s+for\s+([^\s]+)\s+diff\s+([^\s]+)$/) {
Signature · 1 line
gitgitgadget
#2 lore raw

Hi Dominic,

all looks good, with one exception: the Subject should start with <area>:, i.e. in this instance something like this would be better:

contrib/hooks: escape left brace in regex in the paranoid update hook

Ciao,
Johannes

Quoted 37 lines · Dominic Winkler via GitGitGadget

From: Dominic Winkler <[email protected]>

A literal "{" should now be escaped in a pattern starting from perl versions >= v5.26. In perl v5.22, using a literal { in a regular expression was deprecated, and will emit a warning if it isn't escaped: \{. In v5.26, this won't just warn, it'll cause a syntax error.

(see https://metacpan.org/pod/release/RJBS/perl-5.22.0/pod/perldelta.pod)

---
 contrib/hooks/update-paranoid | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
contrib/hooks/update-paranoid +2 -3
index d18b317b2f..fc0a242a4e 100755
@@ -302,13 +302,13 @@ $op = 'U' if ($op eq 'R'
 
 RULE:
 	foreach (@$rules) {
-		while (/\${user\.([a-z][a-zA-Z0-9]+)}/) {
+		while (/\$\{user\.([a-z][a-zA-Z0-9]+)}/) {
 			my $k = lc $1;
 			my $v = $data{"user.$k"};
 			next RULE unless defined $v;
 			next RULE if @$v != 1;
 			next RULE unless defined $v->[0];
-			s/\${user\.$k}/$v->[0]/g;
+			s/\$\{user\.$k}/$v->[0]/g;
 		}
 
 		if (/^([AMD ]+)\s+of\s+([^\s]+)\s+for\s+([^\s]+)\s+diff\s+([^\s]+)$/) {
--

gitgitgadget

#3 lore raw

v2 cover Fix perl error "unescaped left brace in regex" for paranoid update hook

In reply to Dominic Winkler via GitGitGadget

A literal "{" should now be escaped in a pattern starting from perl versions

Quoted 1 line

= v5.26. In perl v5.22, using a literal { in a regular expression was

deprecated, and will emit a warning if it isn't escaped: {. In v5.26, this won't just warn, it'll cause a syntax error.

(see https://metacpan.org/pod/release/RJBS/perl-5.22.0/pod/perldelta.pod)

Dominic Winkler (1):
contrib/hooks: escape left brace in regex in the paranoid update hook

 contrib/hooks/update-paranoid | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

base-commit: 5fa0f5238b0cd46cfe7f6fa76c3f526ea98148d9
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-335%2Fflexarts%2Fmaint-update-paranoid-perlv5.26-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-335/flexarts/maint-update-paranoid-perlv5.26-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/335

Range-diff vs v1:

1: 2743caa22e ! 1: 0d762cfb50 Fix perl error "unescaped left brace in regex" for paranoid update hook
@@ -1,6 +1,6 @@
Author: Dominic Winkler <[email protected]>

- Fix perl error "unescaped left brace in regex" for paranoid update hook
+ contrib/hooks: escape left brace in regex in the paranoid update hook

A literal "{" should now be escaped in a pattern starting from perl versions >= v5.26. In perl v5.22, using a literal { in a regular

Signature · 1 line
gitgitgadget
#4 lore raw

PATCH v2 1/1 contrib/hooks: escape left brace in regex in the paranoid update hook

From: Dominic Winkler <[email protected]>

A literal "{" should now be escaped in a pattern starting from perl versions >= v5.26. In perl v5.22, using a literal { in a regular expression was deprecated, and will emit a warning if it isn't escaped: \{. In v5.26, this won't just warn, it'll cause a syntax error.

(see https://metacpan.org/pod/release/RJBS/perl-5.22.0/pod/perldelta.pod)

---
 contrib/hooks/update-paranoid | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
contrib/hooks/update-paranoid +2 -2
index d18b317b2f..fc0a242a4e 100755
@@ -302,13 +302,13 @@ $op = 'U' if ($op eq 'R'
 
 RULE:
 	foreach (@$rules) {
-		while (/\${user\.([a-z][a-zA-Z0-9]+)}/) {
+		while (/\$\{user\.([a-z][a-zA-Z0-9]+)}/) {
 			my $k = lc $1;
 			my $v = $data{"user.$k"};
 			next RULE unless defined $v;
 			next RULE if @$v != 1;
 			next RULE unless defined $v->[0];
-			s/\${user\.$k}/$v->[0]/g;
+			s/\$\{user\.$k}/$v->[0]/g;
 		}
 
 		if (/^([AMD ]+)\s+of\s+([^\s]+)\s+for\s+([^\s]+)\s+diff\s+([^\s]+)$/) {
Signature · 1 line
gitgitgadget
#5 lore raw

Re: [PATCH v2 1/1] contrib/hooks: escape left brace in regex in the paranoid update hook

Hi Dominic,

Quoted 10 lines · Dominic Winkler via GitGitGadget

From: Dominic Winkler <[email protected]>

A literal "{" should now be escaped in a pattern starting from perl versions >= v5.26. In perl v5.22, using a literal { in a regular expression was deprecated, and will emit a warning if it isn't escaped: \{. In v5.26, this won't just warn, it'll cause a syntax error.

(see https://metacpan.org/pod/release/RJBS/perl-5.22.0/pod/perldelta.pod)

Thank you for addressing my concern so promptly. I am far from a Perl expert, so take this with a train of salt: the patch now looks good to me!

Ciao,
Johannes

Quoted 27 lines
---
 contrib/hooks/update-paranoid | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
contrib/hooks/update-paranoid +2 -3
index d18b317b2f..fc0a242a4e 100755
@@ -302,13 +302,13 @@ $op = 'U' if ($op eq 'R'
 
 RULE:
 	foreach (@$rules) {
-		while (/\${user\.([a-z][a-zA-Z0-9]+)}/) {
+		while (/\$\{user\.([a-z][a-zA-Z0-9]+)}/) {
 			my $k = lc $1;
 			my $v = $data{"user.$k"};
 			next RULE unless defined $v;
 			next RULE if @$v != 1;
 			next RULE unless defined $v->[0];
-			s/\${user\.$k}/$v->[0]/g;
+			s/\$\{user\.$k}/$v->[0]/g;
 		}
 
 		if (/^([AMD ]+)\s+of\s+([^\s]+)\s+for\s+([^\s]+)\s+diff\s+([^\s]+)$/) {
--

gitgitgadget