git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fredrik Tolf <fredrik@dolda2000.com>
To: git@vger.kernel.org
Cc: Fredrik Tolf <fredrik@dolda2000.com>
Subject: [PATCH] Ensure that SSH runs in non-interactive mode
Date: Sat, 19 Jul 2008 19:06:55 +0200	[thread overview]
Message-ID: <1216487215-6927-1-git-send-email-fredrik@dolda2000.com> (raw)

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

             reply	other threads:[~2008-07-19 17:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-19 17:06 Fredrik Tolf [this message]
2008-07-19 17:52 ` [PATCH] Ensure that SSH runs in non-interactive mode 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1216487215-6927-1-git-send-email-fredrik@dolda2000.com \
    --to=fredrik@dolda2000.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).