[PATCH] xfstests: fix specifying configuration value with equality sign

Lukas Czerner lczerner at redhat.com
Thu Apr 10 04:55:37 CDT 2014


Currently there is a problem with parse_config_section() when the
configuration value contains equality sign like this for example:

MOUNT_OPTIONS="-o data=journal"

the result will be

export MOUNT_OPTIONS="-o data="journal"

which is not going to work. The reason is that the expression used to
parse the configuration options uses greedy matching '.*'. Fix this by
using non greedy expression to match the first equality sign '[^=]'.

Signed-off-by: Lukas Czerner <lczerner at redhat.com>
---
 common/config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/config b/common/config
index 00249e6..49f34cf 100644
--- a/common/config
+++ b/common/config
@@ -349,7 +349,7 @@ parse_config_section() {
 		-e 's/#.*$//' \
 		-e 's/[[:space:]]*$//' \
 		-e 's/^[[:space:]]*//' \
-		-e "s/^\(.*\)=\"\?'\?\([^\"']*\)\"\?'\?$/export \1=\"\2\"/" \
+		-e "s/^\([^=]*\)=\"\?'\?\([^\"']*\)\"\?'\?$/export \1=\"\2\"/" \
 		< $HOST_OPTIONS \
 		| sed -n -e "/^\[$SECTION\]/,/^\s*\[/{/^[^#].*\=.*/p;}"`
 }
-- 
1.8.3.1



More information about the xfs mailing list