in order to prevent configuration errors or the configuration being
misinterpreted.

Signed-off-by: Max Carrara <m.carr...@proxmox.com>
---
Changes v3 --> v4:
  * new

Changes v4 --> v5:
  * escape *all* comment literals (that are not escaped) instead of only
    escaping them within values

 src/PVE/CephConfig.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/PVE/CephConfig.pm b/src/PVE/CephConfig.pm
index 845b7d2..0def1f2 100644
--- a/src/PVE/CephConfig.pm
+++ b/src/PVE/CephConfig.pm
@@ -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;
 }
 
-- 
2.39.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to