From f71b9335f1df124cd0655d88c3df401793530aaa Mon Sep 17 00:00:00 2001 From: Mario Loriedo Date: Wed, 26 Nov 2025 13:19:18 +0100 Subject: [PATCH] Replace FindExecutablePeer with FindHelperBinary The WSL machine start was using the function FindExecutablePeer that ignores user configuration (helper_binaries_dir). FindHelperBinary instead is used when starting the machine for the rest of the providers and honors user configuration. This commit requires https://github.com/containers/container-libs/commit/4877783c373caf006a6d031db4d39ef4c6f3cf55 Signed-off-by: Mario Loriedo --- pkg/machine/machine_windows.go | 21 ++++++--------------- pkg/machine/wsl/usermodenet.go | 8 ++++++-- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/pkg/machine/machine_windows.go b/pkg/machine/machine_windows.go index eb279673d4..2348bb0ee8 100644 --- a/pkg/machine/machine_windows.go +++ b/pkg/machine/machine_windows.go @@ -20,6 +20,7 @@ import ( "github.com/containers/podman/v6/pkg/machine/env" "github.com/containers/podman/v6/pkg/machine/sockets" "github.com/sirupsen/logrus" + "go.podman.io/common/pkg/config" "go.podman.io/storage/pkg/fileutils" ) @@ -132,7 +133,11 @@ func launchWinProxy(opts WinProxyOpts) (bool, string, error) { globalName := PipeNameAvailable(GlobalNamedPipe, GlobalNameWait) - command, err := FindExecutablePeer(winSSHProxy) + cfg, err := config.Default() + if err != nil { + return globalName, "", err + } + command, err := cfg.FindHelperBinary(winSSHProxy, false) if err != nil { return globalName, "", err } @@ -241,20 +246,6 @@ func sendQuit(tid uint32) { _, _, _ = postMessage.Call(uintptr(tid), WM_QUIT, 0, 0) } -func FindExecutablePeer(name string) (string, error) { - exe, err := os.Executable() - if err != nil { - return "", err - } - - exe, err = EvalSymlinksOrClean(exe) - if err != nil { - return "", err - } - - return filepath.Join(filepath.Dir(exe), name), nil -} - func EvalSymlinksOrClean(filePath string) (string, error) { fileInfo, err := os.Lstat(filePath) if err != nil { diff --git a/pkg/machine/wsl/usermodenet.go b/pkg/machine/wsl/usermodenet.go index 55c3af7a9b..7081f642a7 100644 --- a/pkg/machine/wsl/usermodenet.go +++ b/pkg/machine/wsl/usermodenet.go @@ -9,12 +9,12 @@ import ( "os/exec" "path/filepath" - "github.com/containers/podman/v6/pkg/machine" "github.com/containers/podman/v6/pkg/machine/env" "github.com/containers/podman/v6/pkg/machine/vmconfigs" "github.com/containers/podman/v6/pkg/machine/wsl/wutil" "github.com/containers/podman/v6/pkg/specgen" "github.com/sirupsen/logrus" + "go.podman.io/common/pkg/config" ) const gvForwarderPath = "/usr/libexec/podman/gvforwarder" @@ -78,7 +78,11 @@ func startUserModeNetworking(mc *vmconfigs.MachineConfig) error { return nil } - exe, err := machine.FindExecutablePeer(gvProxy) + cfg, err := config.Default() + if err != nil { + return err + } + exe, err := cfg.FindHelperBinary(gvProxy, false) if err != nil { return fmt.Errorf("could not locate %s, which is necessary for user-mode networking, please reinstall", gvProxy) }