Re: [ovs-dev] [PATCH] ovs-vsctl-bashcomp: Make compatible with busybox "awk".

2017-08-09 Thread Ben Pfaff
On Fri, Aug 04, 2017 at 09:54:26AM -0400, Lance Richardson wrote:
> > From: "Ben Pfaff" 
> > To: d...@openvswitch.org
> > Cc: "Ben Pfaff" , "Stuart Cardall" 
> > 
> > Sent: Friday, 14 July, 2017 12:42:54 AM
> > Subject: [ovs-dev] [PATCH] ovs-vsctl-bashcomp: Make compatible with busybox 
> > "awk".
> > 
> > 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 completionok
> > 
> > Reported-by: Stuart Cardall 
> > Signed-off-by: Ben Pfaff 
> > ---
> 
> Makes sense, verified that these test cases now pass in the Alpine
> environment with busybox awk.
> 
> Acked-by: Lance Richardson 

Thanks for the review.  I applied this to master and branch-2.8.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] ovs-vsctl-bashcomp: Make compatible with busybox "awk".

2017-08-04 Thread Lance Richardson
> From: "Ben Pfaff" 
> To: d...@openvswitch.org
> Cc: "Ben Pfaff" , "Stuart Cardall" 
> Sent: Friday, 14 July, 2017 12:42:54 AM
> Subject: [ovs-dev] [PATCH] ovs-vsctl-bashcomp: Make compatible with busybox   
> "awk".
> 
> 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 completionok
> 
> Reported-by: Stuart Cardall 
> Signed-off-by: Ben Pfaff 
> ---

Makes sense, verified that these test cases now pass in the Alpine
environment with busybox awk.

Acked-by: Lance Richardson 
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] ovs-vsctl-bashcomp: Make compatible with busybox "awk".

2017-08-02 Thread Ben Pfaff
This still needs a review.  Anyone?

On Thu, Jul 13, 2017 at 09:42:54PM -0700, Ben Pfaff wrote:
> 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 completionok
> 
> Reported-by: Stuart Cardall 
> Signed-off-by: Ben Pfaff 
> ---
>  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
> 
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] ovs-vsctl-bashcomp: Make compatible with busybox "awk".

2017-07-13 Thread Ben Pfaff
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 completionok

Reported-by: Stuart Cardall 
Signed-off-by: Ben Pfaff 
---
 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

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev