Skip to content

Commit

Permalink
Windows native OpenSSH fix
Browse files Browse the repository at this point in the history
Windows native OpenSSH has alternative behavior for standard I/O
descriptors, which can be selected through the OPENSSH_STDIO_MODE
environement variable. Setting it to "nonsock" is required for
sshfs compatibility.

See PowerShell/openssh-portable#759
for details.

Subitted upstream here
libfuse/sshfs#314
  • Loading branch information
manu0401 committed Nov 20, 2024
1 parent 9329f4b commit 35c6d85
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions patches/30-stdiomode.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From d78a624756d080c80a35886ba3615e809bbdb56b Mon Sep 17 00:00:00 2001
From: Emmanuel Dreyfus <[email protected]>
Date: Wed, 20 Nov 2024 16:00:40 +0100
Subject: [PATCH] Windows native OpenSSH fix

Windows native OpenSSH has alternative behavior for standard I/O
descriptors, which can be selected through the OPENSSH_STDIO_MODE
environement variable. Setting it to "nonsock" is required for
sshfs compatibility.

See https://github.com/PowerShell/openssh-portable/pull/759
for details.
---
sshfs.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/sshfs.c b/sshfs.c
index 89c57606..809568ad 100644
--- a/sshfs.c
+++ b/sshfs.c
@@ -1227,6 +1227,13 @@ static int start_ssh(struct conn *conn)
fprintf(stderr, "\n");
}

+#if defined(__CYGWIN__)
+ /*
+ * Windows native OpenSSH stdio behavior. For details check
+ * https://github.com/PowerShell/openssh-portable/pull/759
+ */
+ putenv("OPENSSH_STDIO_MODE=nonsock");
+#endif
execvp(sshfs.ssh_args.argv[0], sshfs.ssh_args.argv);
fprintf(stderr, "failed to execute '%s': %s\n",
sshfs.ssh_args.argv[0], strerror(errno));

0 comments on commit 35c6d85

Please sign in to comment.