ovn-ctl appends its configured binary directories to PATH.  Binaries
from the caller PATH can therefore take precedence and come from a
different OVN or OVS installation.

Port the fix from OVS commit 25eb72a26b18 ("ovs-ctl: Prepend OVS
binary directories to PATH.").  Prepend the configured OVN and OVS
directories while keeping generic system directories as fallbacks.

Fixes: e02b44657803 ("ovn: Add ovn-ctl to assist with OVN daemon lifecycle.")
Signed-off-by: Ihar Hrachyshka <[email protected]>
---
 utilities/ovn-ctl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
index 3b62ca9b7..7cc965acf 100755
--- a/utilities/ovn-ctl
+++ b/utilities/ovn-ctl
@@ -25,7 +25,12 @@ esac
 for dir in "$sbindir" "$ovn_bindir" "$bindir" /sbin /bin /usr/sbin /usr/bin; do
     case :$PATH: in
         *:$dir:*) ;;
-        *) PATH=$PATH:$dir ;;
+        *)
+            case $dir in
+                $sbindir | $ovn_bindir | $bindir) PATH=$dir:$PATH ;;
+                *) PATH=$PATH:$dir ;;
+            esac
+            ;;
     esac
 done
 
-- 
2.54.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to