]> git.proxmox.com Git - pve-storage.git/commitdiff
cephconfig: escape un-escaped comment literals on write
authorMax Carrara <m.carrara@proxmox.com>
Tue, 2 Apr 2024 14:55:19 +0000 (16:55 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 11 Apr 2024 09:53:37 +0000 (11:53 +0200)
in order to prevent configuration errors or the configuration being
misinterpreted.

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
src/PVE/CephConfig.pm

index 845b7d21c943fd7481d728c1d913090ebdeb7155..0def1f2ba7208904fe708ea60d08792401ae4c1d 100644 (file)
@@ -105,6 +105,9 @@ sub write_ceph_config {
        $cond_write_sec->($re);
     }
 
+    # Escape comment literals that aren't escaped already
+    $out =~ s/(?<!\\)([;#])/\\$1/gm;
+
     return $out;
 }