[OpenStack-Infra] Improving SSH support in git-review

Marcin Cieslak saper at saper.info
Sat Jan 19 23:38:19 UTC 2013


Hello,

I did some work to improve SSH integration
in git-review tool, mainly to address those issues:

- Allow plink.exe to be used as the SSH client
- Respect GIT_SSH (https://bugs.launchpad.net/git-review/+bug/1024054)
- Scp path separator should not be OS-dependent (https://bugs.launchpad.net/git-review/+bug/1024073)

It brings us also close to fixing those bugs:

- Doesn't parse ssh-aliased urls 
(https://bugs.launchpad.net/git-review/+bug/912125)
- git review assumes the wrong port (https://bugs.launchpad.net/git-review/+bug/1075751)


In order to achieve this, I decided to get rid
of "scp/scp.exe/pscp.exe" dependency completely
and allow git-review to adjust options for ssh/ssh.exe/plink.exe
accordingly. 

I have written a trivial SSH wrapper with a simple
rcp protocol support written to allow fetching
"hooks/commit-msg" using ssh/ssh.exe/plink.exe directly
without invoking any for of "scp".

The code is available to play with on:

git clone git://github.com/saper/simple-scp-client.git

Use 

scp.py -p 29418 username at review.openstack.org

to fetch the hooks file from the Gerrit instance.

There is also a simple test suite, but you need
to adjust global variables listed on the top
of the file before running it.

I have tested this on 

Python 2.5 on ancient Solaris with ancient OpenSSH
Python 2.5/2.7 on Gentoo Linux box with OpenSSH
Python 2.7 on FreeBSD with OpenSSH
Python 2.7.2 on Windows Vista using Git for Windows ssh.exe
Python 2.7.2 on Windows Vista using plink.exe, without bash

Python 3.2 is in the works, unfortunately the 
subprocess module there insists on using buffers instead
of strings so a slightly different implementation is needed
incompatible with 2.x.

If you think this is a good idea, I can work on putting
this code into git-review. Basically all SSH invocations
will be done via this code and "set_hooks_commit_msg"
will be greatly simplified.

Feedback welcome:)

There are few mostly cosmeting changes awaiting
review in Gerrit:

https://review.openstack.org/#/q/status:open+project:openstack-infra/git-review,n,z

which I think (except https://review.openstack.org/#/c/18392/ and maybe
https://review.openstack.org/#/c/17552/) could go into the new release,
before completely reworking SSH layer.

Big thanks to fungi for reviewing those patches continuously!

Marcin Cieślak



More information about the OpenStack-Infra mailing list