git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [ANNOUNCE] Git v2.16.0-rc0

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jan 3, 2018, 05:35 UTC
Message-ID
<20180103053516.GB87855@aiede.mtv.corp.google.com>
In-Reply-To
<CAGyf7-FQp4q2vvH1ponQvmVDTu0hiMSK1JKytQZ4O1i0MCnz7g@mail.gmail.com>
Hi,
A few more notes.
Bryan Turner wrote:
Show 6 quoted lines
> bturner@ubuntu:~$ ssh -V
> OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8, OpenSSL 1.0.1f 6 Jan 2014
>
> bturner@ubuntu:~$ ssh -G -p 7999 localhost
> unknown option -- G
> usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[...]
Show 12 quoted lines
> Is it possible to adjust the check, somehow, so it doesn't impact
> older OpenSSH versions like this? As it stands, it seems likely a fair
> number of users who have an SSH command that does support -4, -6 and
> -p are going to end up getting "penalized" because it doesn't also
> support -G, and have to manually set their SSH variant to "ssh" (or
> something other than "auto") to avoid the automatic detection.
>
> I'd love to say I have a brilliant idea for how to work around this,
> oh and here's a patch, but I don't. One option might be trying to
> actually review the output, and another might be to run "ssh -V", but
> both of those have their own flaws (and the extra process forks aren't
> "free").

I have tomorrow off, so I've filed https://crbug.com/git/7 to make sure I remember to follow up the day after. Of course I'll be happy if someone updates that bug saying they've fixed it in the meantime.

One possibility would be to use -V as a fallback when -G fails, or even as a replacement for this usage of -G. To avoid misdetecting PuTTY and other ssh variants that also implement -V as OpenSSH, we would have to parse the output. This would also misdetect a script that does

	host=$1; shift
	ssh "$host" -- "$@"
as supporting OpenSSH options, when the use of -- ensures it doesn't.

Another possibility is to parse the output when -G fails. That's hacky, but I think it would work well! We would not have to be too clever, since we can look for the exact output produced by the versions of OpenSSH that we care about. This still has issues with scripts that forward arguments to OpenSSH, but at least those issues would go away once the user updates their copy of ssh. ;-)

Another possibility is to pass options *before* -V:
	ssh -p 7999 -V

Since OpenSSH parses its arguments left-to-right, this gives similar information to what we did with -G, and scripts like

	host=$1; shift
	ssh "$host" -- "$@"

would even be correctly detected as not supporting OpenSSH options. We still would need to parse the output to distinguish OpenSSH from other ssh implementations like putty (unlike OpenSSH, putty saves up argument errors in an 'error' variable and forgets about them once it sees -V).

Trying -G and falling back to -V seems like the simplest detection mechanism to me at the moment. I'm hoping I'm missing something simple (another ssh option?) that allows avoiding this mess.

Regardless, I think we should do something like [1] first to get rid of the regression. Thanks again for reporting it.

Sincerely, Jonathan

[1] https://public-inbox.org/git/20180103050730.GA87855@aiede.mtv.corp.google.com/
Previous: Junio C HamanoNext: Jeff King
Message 11 of 20 in “[ANNOUNCE] Git v2.16.0-rc0”
  1. Junio C HamanoDec 29, 2017
  2. Kaartic SivaraamDec 29, 2017
  3. Paul SmithDec 29, 2017
  4. Thomas GummererJan 4, 2018
  5. Paul SmithJan 4, 2018
  6. Bryan TurnerJan 3, 2018
  7. Jonathan NiederJan 3, 2018
  8. Bryan TurnerJan 3, 2018
  9. Jonathan NiederJan 3, 2018
  10. Junio C HamanoJan 3, 2018
  11. Jonathan NiederJan 3, 2018
  12. Jeff KingJun 8, 2018
  13. Junio C HamanoJun 12, 2018
  14. Jeff KingJun 14, 2018
  15. Jonathan NiederJun 14, 2018
  16. Jeff KingJun 14, 2018
  17. Jonathan NiederJun 15, 2018
  18. Jeff KingJun 15, 2018
  19. Jeff KingJun 15, 2018
  20. Johannes SchindelinJan 4, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.