xfstests: fix specifying configuration value with equality sign
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
@@ -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
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 '[^=]'.
Signed-off-by Lukas Czerner <[email protected]>
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