git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Bryan Turner <bturner@atlassian.com>,
	Brandon Williams <bmwill@google.com>,
	Ben Humphreys <behumphreys@atlassian.com>,
	Git Users <git@vger.kernel.org>,
	git-packagers@googlegroups.com
Subject: Re: [ANNOUNCE] Git v2.16.0-rc0
Date: Wed, 03 Jan 2018 13:15:17 -0800	[thread overview]
Message-ID: <xmqqk1wyhcey.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20180103050730.GA87855@aiede.mtv.corp.google.com> (Jonathan Nieder's message of "Tue, 2 Jan 2018 21:07:30 -0800")

Jonathan Nieder <jrnieder@gmail.com> writes:

> It's good you caught this flaw in the detection.  Would something like
> the following make sense?  If so, I can resend with a commit message
> and tests tomorrow or the day after.

So the idea is to keep the 'simple' for implementations that do not
support OpenSSH options, but declare that the auto-detection was
overly conservative and assume that -4/6/p are supported by
everybody?

This change means that those who were meant to be helped by the
original change, that introduced 'simple' and made the (overly
conservative) auto-detection, would now have to explicitly set
ssh.variant to simple, because otherwise they will be passed one of
these three options.  Am I reading the intention of the change
correctly?  If so, I tend to agree that it is lesser of the two
evils to make sure things continue to work for older openssh users
with their current setting like this patch does, even with the cost
of telling users with implementations that do not honor -4/6/p to
set things up manually, I guess.

Thanks, both, for digging this issue through.

>
> diff --git i/Documentation/config.txt w/Documentation/config.txt
> index 64c1dbba94..75eafd8db6 100644
> --- i/Documentation/config.txt
> +++ w/Documentation/config.txt
> @@ -2118,8 +2118,8 @@ ssh.variant::
>  	unrecognized, Git will attempt to detect support of OpenSSH
>  	options by first invoking the configured SSH command with the
>  	`-G` (print configuration) option and will subsequently use
> -	OpenSSH options (if that is successful) or no options besides
> -	the host and remote command (if it fails).
> +	OpenSSH options if that is successful or a conservative set of
> +	OpenSSH-style options if it fails.
>  +
>  The config variable `ssh.variant` can be set to override this detection.
>  Valid values are `ssh` (to use OpenSSH options), `plink`, `putty`,
> diff --git i/connect.c w/connect.c
> index c3a014c5ba..3784c2be53 100644
> --- i/connect.c
> +++ w/connect.c
> @@ -941,10 +941,9 @@ static void push_ssh_options(struct argv_array *args, struct argv_array *env,
>  
>  	if (flags & CONNECT_IPV4) {
>  		switch (variant) {
> -		case VARIANT_AUTO:
> -			BUG("VARIANT_AUTO passed to push_ssh_options");
>  		case VARIANT_SIMPLE:
>  			die("ssh variant 'simple' does not support -4");
> +		case VARIANT_AUTO:
>  		case VARIANT_SSH:
>  		case VARIANT_PLINK:
>  		case VARIANT_PUTTY:
> @@ -953,10 +952,9 @@ static void push_ssh_options(struct argv_array *args, struct argv_array *env,
>  		}
>  	} else if (flags & CONNECT_IPV6) {
>  		switch (variant) {
> -		case VARIANT_AUTO:
> -			BUG("VARIANT_AUTO passed to push_ssh_options");
>  		case VARIANT_SIMPLE:
>  			die("ssh variant 'simple' does not support -6");
> +		case VARIANT_AUTO:
>  		case VARIANT_SSH:
>  		case VARIANT_PLINK:
>  		case VARIANT_PUTTY:
> @@ -970,10 +968,9 @@ static void push_ssh_options(struct argv_array *args, struct argv_array *env,
>  
>  	if (port) {
>  		switch (variant) {
> -		case VARIANT_AUTO:
> -			BUG("VARIANT_AUTO passed to push_ssh_options");
>  		case VARIANT_SIMPLE:
>  			die("ssh variant 'simple' does not support setting port");
> +		case VARIANT_AUTO:
>  		case VARIANT_SSH:
>  			argv_array_push(args, "-p");
>  			break;
> @@ -1026,7 +1023,7 @@ static void fill_ssh_args(struct child_process *conn, const char *ssh_host,
>  				 VARIANT_SSH, port, flags);
>  		argv_array_push(&detect.args, ssh_host);
>  
> -		variant = run_command(&detect) ? VARIANT_SIMPLE : VARIANT_SSH;
> +		variant = run_command(&detect) ? VARIANT_AUTO : VARIANT_SSH;
>  	}
>  
>  	argv_array_push(&conn->args, ssh);
> diff --git i/t/t5601-clone.sh w/t/t5601-clone.sh
> index 0f895478f0..0224edc85b 100755
> --- i/t/t5601-clone.sh
> +++ w/t/t5601-clone.sh
> @@ -365,6 +365,11 @@ test_expect_success 'OpenSSH variant passes -4' '
>  	expect_ssh "-4 -p 123" myhost src
>  '
>  
> +test_expect_success 'OpenSSH passes GIT_PROTOCOL envvar' '
> +	git -c protocol.version=1 clone [myhost:123]:src ssh-v1-clone &&
> +	expect_ssh "-o SendEnv=GIT_PROTOCOL -p 123" myhost src
> +'
> +
>  test_expect_success 'variant can be overridden' '
>  	copy_ssh_wrapper_as "$TRASH_DIRECTORY/putty" &&
>  	git -c ssh.variant=putty clone -4 "[myhost:123]:src" ssh-putty-clone &&
> @@ -377,19 +382,32 @@ test_expect_success 'variant=auto picks based on basename' '
>  	expect_ssh "-4 -P 123" myhost src
>  '
>  
> -test_expect_success 'simple does not support -4/-6' '
> +test_expect_success 'variant=simple does not support -4/-6' '
>  	copy_ssh_wrapper_as "$TRASH_DIRECTORY/simple" &&
> -	test_must_fail git clone -4 "myhost:src" ssh-4-clone-simple
> +	test_must_fail git -c ssh.variant=simple clone -4 "myhost:src" ssh-4-clone-simple
>  '
>  
> -test_expect_success 'simple does not support port' '
> +test_expect_success 'variant=simple does not support port' '
>  	copy_ssh_wrapper_as "$TRASH_DIRECTORY/simple" &&
> -	test_must_fail git clone "[myhost:123]:src" ssh-bracket-clone-simple
> +	test_must_fail git -c ssh.variant=simple clone "[myhost:123]:src" ssh-bracket-clone-simple
> +'
> +
> +test_expect_success 'old OpenSSH passes -4 and -p' '
> +	copy_ssh_wrapper_as "$TRASH_DIRECTORY/old" &&
> +	git -c ssh.variant=auto clone -4 "[myhost:123]:src" old-ssh-clone &&
> +	expect_ssh "-4 -p 123" myhost src
>  '
>  
> -test_expect_success 'uplink is treated as simple' '
> +test_expect_success 'old OpenSSH does not pass GIT_PROTOCOL envvar' '
> +	copy_ssh_wrapper_as "$TRASH_DIRECTORY/old" &&
> +	git -c protocol.version=1 -c ssh.variant=auto clone "[myhost:123]:src" old-ssh-protocol-v1 &&
> +	expect_ssh "-p 123" myhost src
> +'
> +
> +test_expect_success 'uplink is treated as old OpenSSH' '
>  	copy_ssh_wrapper_as "$TRASH_DIRECTORY/uplink" &&
> -	test_must_fail git clone "[myhost:123]:src" ssh-bracket-clone-uplink &&
> +	git -c protocol.version=1 clone "[myhost:123]:src" ssh-bracket-clone-uplink &&
> +	expect_ssh "-p 123" myhost src &&
>  	git clone "myhost:src" ssh-clone-uplink &&
>  	expect_ssh myhost src
>  '
> @@ -405,8 +423,8 @@ test_expect_success 'OpenSSH-like uplink is treated as ssh' '
>  	test_when_finished "rm -f \"\$TRASH_DIRECTORY/uplink\"" &&
>  	GIT_SSH="$TRASH_DIRECTORY/uplink" &&
>  	test_when_finished "GIT_SSH=\"\$TRASH_DIRECTORY/ssh\$X\"" &&
> -	git clone "[myhost:123]:src" ssh-bracket-clone-sshlike-uplink &&
> -	expect_ssh "-p 123" myhost src
> +	git -c protocol.version=1 clone "[myhost:123]:src" ssh-bracket-clone-sshlike-uplink &&
> +	expect_ssh "-o SendEnv=GIT_PROTOCOL -p 123" myhost src
>  '
>  
>  test_expect_success 'plink is treated specially (as putty)' '

  parent reply	other threads:[~2018-01-03 21:15 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-29  4:30 [ANNOUNCE] Git v2.16.0-rc0 Junio C Hamano
2017-12-29  7:17 ` Kaartic Sivaraam
2017-12-29 17:13 ` Paul Smith
2018-01-04 20:18   ` Thomas Gummerer
2018-01-04 21:35     ` Paul Smith
2018-01-03  3:34 ` Bryan Turner
2018-01-03  5:07   ` Jonathan Nieder
2018-01-03  5:41     ` Bryan Turner
2018-01-03  5:50       ` Jonathan Nieder
2018-01-03 21:15     ` Junio C Hamano [this message]
2018-01-03  5:35   ` Jonathan Nieder
2018-06-08  4:50     ` Jeff King
2018-06-12 16:29       ` Junio C Hamano
2018-06-14 18:30         ` Jeff King
2018-06-14 18:55           ` Jonathan Nieder
2018-06-14 19:39             ` Jeff King
2018-06-15  4:20               ` Jonathan Nieder
2018-06-15  5:13                 ` Jeff King
2018-06-15  7:26                   ` Jeff King
2018-01-04 20:33 ` Johannes Schindelin

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqqk1wyhcey.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=behumphreys@atlassian.com \
    --cc=bmwill@google.com \
    --cc=bturner@atlassian.com \
    --cc=git-packagers@googlegroups.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).