git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Ensure that SSH runs in non-interactive mode
@ 2008-07-19 17:06 Fredrik Tolf
  2008-07-19 17:52 ` Mike Hommey
  2008-07-19 17:57 ` Keith Packard
  0 siblings, 2 replies; 16+ messages in thread
From: Fredrik Tolf @ 2008-07-19 17:06 UTC (permalink / raw)
  To: git; +Cc: Fredrik Tolf

OpenSSH has the nice feature that it sets the IP TOS value of its
connection depending on usage. When used in interactive mode, it
is set to Minimize-Delay, and other wise to Maximize-Throughput. Its
usage by Git is best served by Maximize-Throughput, for obvious
reasons.

However, it seems to use a DWIM heuristic for detecting interactive
mode. The current implementation enters interactive mode if either
a PTY is allocated or X11 forwarding is enabled, and even though Git
SSH:ing does not allocate a PTY, X11 forwarding is often turned on
by default. By removing the DISPLAY env variable before forking, SSH
can thus be forced into non-interactive mode, without any obvious
ill effects.

Signed-off-by: Fredrik Tolf <fredrik@dolda2000.com>
---
 connect.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/connect.c b/connect.c
index 574f42f..54888d3 100644
--- a/connect.c
+++ b/connect.c
@@ -607,6 +607,13 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
 			*arg++ = port;
 		}
 		*arg++ = host;
+		/* Remove the X11 DISPLAY from the environment, to
+		 * make SSH run non-interactively */
+		const char *env[] = {
+			"DISPLAY",
+			NULL
+		};
+		conn->env = env;
 	}
 	else {
 		/* remove these from the environment */
-- 
1.5.6.2

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-07-21  7:06 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-19 17:06 [PATCH] Ensure that SSH runs in non-interactive mode Fredrik Tolf
2008-07-19 17:52 ` Mike Hommey
2008-07-19 17:57 ` Keith Packard
2008-07-19 18:18   ` Fredrik Tolf
2008-07-20 10:27     ` Johannes Schindelin
2008-07-20 17:49       ` Fredrik Tolf
2008-07-20 18:33         ` Johannes Schindelin
2008-07-20 18:42           ` Fredrik Tolf
2008-07-20 18:23       ` Junio C Hamano
2008-07-20 18:57         ` Johannes Schindelin
2008-07-20 19:51           ` Junio C Hamano
2008-07-20 22:17             ` Johannes Schindelin
2008-07-21  5:07             ` Steffen Prohaska
2008-07-21  0:14         ` Jeff King
2008-07-21  6:53           ` Mike Hommey
2008-07-21  7:05             ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).