[pve-devel] [PATCH manager] ceph: make config parser less greedy

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Dec 15 08:12:46 CET 2015


Options such as:
  osd mount options xfs = -i size=2048 -n size=16k
were parsed as:
  key: 'osd mount options xfs = -i size=2048 -n size'
  value: '16k'

This is due to the greedy .* in the beginning. Making it
non-greedy fixes this.

Fixes #851
---
 PVE/CephTools.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/CephTools.pm b/PVE/CephTools.pm
index 1c639e3..ec91f44 100644
--- a/PVE/CephTools.pm
+++ b/PVE/CephTools.pm
@@ -139,7 +139,7 @@ sub parse_ceph_config {
 	    next;
 	}
 
-	if ($line =~ m/^(.*\S)\s*=\s*(\S.*)$/) {
+	if ($line =~ m/^(.*?\S)\s*=\s*(\S.*)$/) {
 	    $cfg->{$section}->{$1} = $2;
 	}
 
-- 
2.1.4





More information about the pve-devel mailing list