From patchwork Fri Jul 14 04:42:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 788110 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x80x334zzz9s7m for ; Fri, 14 Jul 2017 15:04:55 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id D4568D91; Fri, 14 Jul 2017 04:43:06 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 2FFF5D7F for ; Fri, 14 Jul 2017 04:43:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 3BBE93D3 for ; Fri, 14 Jul 2017 04:43:03 +0000 (UTC) Received: from mfilter14-d.gandi.net (mfilter14-d.gandi.net [217.70.178.142]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id 075EE41C084; Fri, 14 Jul 2017 06:43:02 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter14-d.gandi.net Received: from relay5-d.mail.gandi.net ([IPv6:::ffff:217.70.183.197]) by mfilter14-d.gandi.net (mfilter14-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id EQFDf1UaCDiH; Fri, 14 Jul 2017 06:43:00 +0200 (CEST) X-Originating-IP: 173.228.112.34 Received: from sigabrt.gateway.sonic.net (173-228-112-34.dsl.dynamic.fusionbroadband.com [173.228.112.34]) (Authenticated sender: blp@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 7420A41C07E; Fri, 14 Jul 2017 06:42:57 +0200 (CEST) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 13 Jul 2017 21:42:54 -0700 Message-Id: <20170714044254.23293-1-blp@ovn.org> X-Mailer: git-send-email 2.10.2 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff , Stuart Cardall Subject: [ovs-dev] [PATCH] ovs-vsctl-bashcomp: Make compatible with busybox "awk". X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 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 Signed-off-by: Ben Pfaff Acked-by: Lance Richardson --- 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.