From patchwork Wed Oct 28 19:47:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Flavio Leitner X-Patchwork-Id: 1389389 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=sysclose.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sysclose.org header.i=@sysclose.org header.a=rsa-sha256 header.s=201903 header.b=Z0WjPA0y; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CLzdb5bStz9sVT for ; Thu, 29 Oct 2020 06:48:16 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 625FB86A4D; Wed, 28 Oct 2020 19:48:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WNXDHsJZlLIH; Wed, 28 Oct 2020 19:48:12 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 825BD8694F; Wed, 28 Oct 2020 19:48:12 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 62094C0859; Wed, 28 Oct 2020 19:48:12 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id BC1CCC0051 for ; Wed, 28 Oct 2020 19:48:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id AB46D20382 for ; Wed, 28 Oct 2020 19:48:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0jjFJ6JjNdWQ for ; Wed, 28 Oct 2020 19:48:08 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sysclose.org (smtp.sysclose.org [69.164.214.230]) by silver.osuosl.org (Postfix) with ESMTPS id 8B5F72035B for ; Wed, 28 Oct 2020 19:48:08 +0000 (UTC) Received: from localhost (unknown [45.71.105.237]) by sysclose.org (Postfix) with ESMTPSA id 1E1A32CEB; Wed, 28 Oct 2020 19:48:14 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 sysclose.org 1E1A32CEB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sysclose.org; s=201903; t=1603914495; bh=j3y2W/AnLuiNDj/+UKyDJTN/komZWsG1+1W0/I+aC+E=; h=From:To:Cc:Subject:Date:From; b=Z0WjPA0y14oZjT5USeJ5y6c5KdY+iLjjyRMVNh/4pob7WuKE2ovRiQHkEne0TdyPb NhhMzaQV/V0JxxmHet354TxevOLyXzA8F06KPDCgqupTm3Iy5rV9nf4UbmJNyWxeS9 KmehWgLUhEgvqcQYewBiWOl79RZjN3iyhIkxLRKanP13FqrtPx/xHHvjQ9ksz599fc 77Qt6tMTdfFGiFwvqg1K9diO4l5POj+4iqBRMrWHMWaAASDIJCEf1pHUfxhxkK3aar OkwVOOC9XElXyb89FfrQkg1vEULyr4uAMFX286bPGnfZZ/IBUmzGeC8S7IZgsS3B7v rvFTiwecLdZEw== From: Flavio Leitner To: dev@openvswitch.org Date: Wed, 28 Oct 2020 16:47:52 -0300 Message-Id: <20201028194752.1409953-1-fbl@sysclose.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Cc: Flavio Leitner Subject: [ovs-dev] [PATCH] ovs-ctl: Prepend OVS binary directories to PATH. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The inclusion of LSB functions in ovs-lib resets $PATH to system's default. Then ovs-ctl appends missing directories including the OVS default ones $sbindir and $bindir. The problem is that the wrong binaries can be used if they are available in the system's default locations because of the PATH wrong order. The same issue happens if one changes $OVS_BINDIR or $OVS_SBINDIR variables. The solution is to prepend those directories if they are not already in PATH. Reported-by: Mark Gray Signed-off-by: Flavio Leitner Acked-by: Mark Gray Acked-by: Paolo Valerio --- utilities/ovs-ctl.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index 8c5cd7032..8ff500f0d 100644 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -22,7 +22,11 @@ esac for dir in "$sbindir" "$bindir" /sbin /bin /usr/sbin /usr/bin; do case :$PATH: in *:$dir:*) ;; - *) PATH=$PATH:$dir ;; + *) + case $dir in + $sbindir | $bindir) PATH=$dir:$PATH ;; + *) PATH=$PATH:$dir ;; + esac esac done