From 38dcd6eda5f7f89eabbe5a65ad205853c99b604a Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Mon, 16 Aug 2021 09:48:29 -0500 Subject: [PATCH] fix gvproxy path search for macos macos does not have /usr/libexec/ so we look in the executable paths first. Fixes: #11226 [NO TESTS NEEDED] Signed-off-by: Brent Baude --- pkg/machine/qemu/machine.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go index dc77037249..4bb985962f 100644 --- a/pkg/machine/qemu/machine.go +++ b/pkg/machine/qemu/machine.go @@ -622,10 +622,15 @@ func CheckActiveVM() (bool, string, error) { // startHostNetworking runs a binary on the host system that allows users // to setup port forwarding to the podman virtual machine func (v *MachineVM) startHostNetworking() error { - // TODO we may wish to configure the directory in containers common - binary := filepath.Join("/usr/libexec/podman/", machine.ForwarderBinaryName) - if _, err := os.Stat(binary); err != nil { - return err + // MacOS does not have /usr/libexec so we look in the executable + // paths. + binary, err := exec.LookPath(machine.ForwarderBinaryName) + if errors.Cause(err) == exec.ErrNotFound { + // Nothing was found, so now check /usr/libexec, else error out + binary = filepath.Join("/usr/libexec/podman/", machine.ForwarderBinaryName) + if _, err := os.Stat(binary); err != nil { + return err + } } // Listen on all at port 7777 for setting up and tearing