[pve-devel] [PATCH v2 manager 1/3] vzdump: notes-template: avoid escaping meta-characters upon replace

Fabian Ebner f.ebner at proxmox.com
Tue May 3 13:17:58 CEST 2022


which is caused by the quoting operators \Q...\E. The actual intention
was to avoid such surprises.

Fixes: 413bb432 ("partially close #438: vzdump: support setting notes-template")
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

Changes from v1:
    * Add follow-ups to further improve behavior.

 PVE/VZDump.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 22fdb324..9af2de3d 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -90,7 +90,7 @@ my $generate_notes = sub {
     $notes_template =~ s/\\(.)/$unescape->($1)/eg;
 
     my $vars = join('|', keys $info->%*);
-    $notes_template =~ s/\{\{($vars)\}\}/\Q$info->{$1}\E/g;
+    $notes_template =~ s/\{\{($vars)\}\}/$info->{$1}/g;
 
     die "unexpected variable name '$1'" if $notes_template =~ m/\{\{([^\s]+)\}\}/;
 
-- 
2.30.2






More information about the pve-devel mailing list