[ovs-dev] [PATCH] ovs-vsctl-bashcomp: Make compatible with busybox "awk".
Ben Pfaff
blp at ovn.org
Fri Jul 14 04:42:54 UTC 2017
It seems that awk in busybox doesn't think that an empty string is part of
a larger string, but that GNU awk does. This commit adds an extra test to
make _ovs_vsctl_check_startswith_string work either way.
This allows the following tests to pass with busybox awk:
vsctl bashcomp unit tests
7: vsctl-bashcomp - basic verification ok
8: vsctl-bashcomp - argument completion ok
Reported-by: Stuart Cardall <developer at it-offshore.co.uk>
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
utilities/ovs-vsctl-bashcomp.bash | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utilities/ovs-vsctl-bashcomp.bash b/utilities/ovs-vsctl-bashcomp.bash
index a3273f8eec4f..fc8245bfb553 100755
--- a/utilities/ovs-vsctl-bashcomp.bash
+++ b/utilities/ovs-vsctl-bashcomp.bash
@@ -47,7 +47,7 @@ declare -A _OVS_VSCTL_NEW_RECORDS
# the input; this behaves like 'grep "^$1"' but deals with regex
# metacharacters in $1.
_ovs_vsctl_check_startswith_string () {
- awk 'index($0, thearg)==1' thearg="$1"
+ awk 'thearg == "" || index($0, thearg)==1' thearg="$1"
}
# $1 = word to complete on.
--
2.10.2
More information about the dev
mailing list