* [PATCH] xfstests: fix specifying configuration value with equality sign
@ 2014-04-10 9:55 Lukas Czerner
2014-04-11 0:14 ` Dave Chinner
0 siblings, 1 reply; 2+ messages in thread
From: Lukas Czerner @ 2014-04-10 9:55 UTC (permalink / raw)
To: xfs; +Cc: 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
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@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
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xfstests: fix specifying configuration value with equality sign
2014-04-10 9:55 [PATCH] xfstests: fix specifying configuration value with equality sign Lukas Czerner
@ 2014-04-11 0:14 ` Dave Chinner
0 siblings, 0 replies; 2+ messages in thread
From: Dave Chinner @ 2014-04-11 0:14 UTC (permalink / raw)
To: Lukas Czerner; +Cc: xfs
On Thu, Apr 10, 2014 at 11:55:37AM +0200, Lukas Czerner wrote:
> 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@redhat.com>
Looks fine.
Reviewed-by: Dave Chinner <dchinner@redhat.com>
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.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-04-11 0:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-10 9:55 [PATCH] xfstests: fix specifying configuration value with equality sign Lukas Czerner
2014-04-11 0:14 ` Dave Chinner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.