Skip to content

Commit f71b933

Browse files
committed
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 containers/container-libs@4877783 Signed-off-by: Mario Loriedo <[email protected]>
1 parent 2613d73 commit f71b933

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

pkg/machine/machine_windows.go

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/containers/podman/v6/pkg/machine/env"
2121
"github.com/containers/podman/v6/pkg/machine/sockets"
2222
"github.com/sirupsen/logrus"
23+
"go.podman.io/common/pkg/config"
2324
"go.podman.io/storage/pkg/fileutils"
2425
)
2526

@@ -132,7 +133,11 @@ func launchWinProxy(opts WinProxyOpts) (bool, string, error) {
132133

133134
globalName := PipeNameAvailable(GlobalNamedPipe, GlobalNameWait)
134135

135-
command, err := FindExecutablePeer(winSSHProxy)
136+
cfg, err := config.Default()
137+
if err != nil {
138+
return globalName, "", err
139+
}
140+
command, err := cfg.FindHelperBinary(winSSHProxy, false)
136141
if err != nil {
137142
return globalName, "", err
138143
}
@@ -241,20 +246,6 @@ func sendQuit(tid uint32) {
241246
_, _, _ = postMessage.Call(uintptr(tid), WM_QUIT, 0, 0)
242247
}
243248

244-
func FindExecutablePeer(name string) (string, error) {
245-
exe, err := os.Executable()
246-
if err != nil {
247-
return "", err
248-
}
249-
250-
exe, err = EvalSymlinksOrClean(exe)
251-
if err != nil {
252-
return "", err
253-
}
254-
255-
return filepath.Join(filepath.Dir(exe), name), nil
256-
}
257-
258249
func EvalSymlinksOrClean(filePath string) (string, error) {
259250
fileInfo, err := os.Lstat(filePath)
260251
if err != nil {

pkg/machine/wsl/usermodenet.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import (
99
"os/exec"
1010
"path/filepath"
1111

12-
"github.com/containers/podman/v6/pkg/machine"
1312
"github.com/containers/podman/v6/pkg/machine/env"
1413
"github.com/containers/podman/v6/pkg/machine/vmconfigs"
1514
"github.com/containers/podman/v6/pkg/machine/wsl/wutil"
1615
"github.com/containers/podman/v6/pkg/specgen"
1716
"github.com/sirupsen/logrus"
17+
"go.podman.io/common/pkg/config"
1818
)
1919

2020
const gvForwarderPath = "/usr/libexec/podman/gvforwarder"
@@ -78,7 +78,11 @@ func startUserModeNetworking(mc *vmconfigs.MachineConfig) error {
7878
return nil
7979
}
8080

81-
exe, err := machine.FindExecutablePeer(gvProxy)
81+
cfg, err := config.Default()
82+
if err != nil {
83+
return err
84+
}
85+
exe, err := cfg.FindHelperBinary(gvProxy, false)
8286
if err != nil {
8387
return fmt.Errorf("could not locate %s, which is necessary for user-mode networking, please reinstall", gvProxy)
8488
}

0 commit comments

Comments
 (0)