[pve-devel] [PATCH common] tools: template_replace: esacpe braces

Thomas Lamprecht t.lamprecht at proxmox.com
Sun Nov 18 16:06:19 CET 2018


To avoid warnings (and in the future, errors) like:

> 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 /usr/share/perl5/PVE/Tools.pm
> line 673.

with future perl versions, like Debian Buster for example has.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/Tools.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index 6254b2e..0f31fdb 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -670,7 +670,7 @@ sub template_replace {
     return $tmpl if !$tmpl;
 
     my $res = '';
-    while ($tmpl =~ m/([^{]+)?({([^}]+)})?/g) {
+    while ($tmpl =~ m/([^{]+)?(\{([^}]+)\})?/g) {
 	$res .= $1 if $1;
 	$res .= ($data->{$3} || '-') if $2;
     }
-- 
2.19.1





More information about the pve-devel mailing list