Skip to contentSkip to conversation

xfstests: fix specifying configuration value with equality sign

PATCH In review Lukas Czerner 2 participants 2 messages Apr 10, 2014 – Apr 11, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests: fix specifying configuration value with equality sign

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 '[^=]'.

---
 common/config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/config +1 -1
index 00249e6..49f34cf 100644
@@ -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;}"`
 }
Signature · 6 lines
1.8.3.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Lukas Czerner

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

Quoted 7 lines

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 '[^=]'.

Looks fine.

It would probably be a good idea to comment what the sed line noise is actually doing, so it's easier to understand in future...

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs