From 24dfa16a67c6e1d4e82394cb9d4903e21552ad60 Mon Sep 17 00:00:00 2001 From: Arthur Sengileyev Date: Sun, 23 Mar 2025 21:58:16 +0200 Subject: [PATCH] Disable ControlPersist for sshfs connections on Windows Lima recommended OpenSSH distribution on Windows platform has limited fucntionality over mux socket. Most notably it can't pass FDs over socket. This results in error messages and internal fallbacks, but also had higher failure rate during testing. It is reasonable to disable this for sftp-server communications on Windows to improve stability. Signed-off-by: Arthur Sengileyev --- pkg/hostagent/mount.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/hostagent/mount.go b/pkg/hostagent/mount.go index cfc3f3bbb8f..877d759fd0f 100644 --- a/pkg/hostagent/mount.go +++ b/pkg/hostagent/mount.go @@ -68,6 +68,13 @@ func (a *HostAgent) setupMount(m limayaml.Mount) (*mount, error) { Readonly: !(*m.Writable), SSHFSAdditionalArgs: []string{"-o", sshfsOptions}, } + if runtime.GOOS == "windows" { + // cygwin/msys2 doesn't support full feature set over mux socket, this has at least 2 side effects: + // 1. unnecessary pollutes output with error on errors encountered (ssh will try to tolerate them with fallbacks); + // 2. these errors still imply additional coms over mux socket, which resulted sftp-server to fail more often statistically during test runs. + // It is reasonable to disable this on Windows if required feature is not fully operational. + rsf.SSHConfig.Persist = false + } if err := rsf.Prepare(); err != nil { return nil, fmt.Errorf("failed to prepare reverse sshfs for %q on %q: %w", resolvedLocation, *m.MountPoint, err) }