This is an archive of the discontinued Mercurial Phabricator instance.

sshpeer: allow for additional environment passing to ssh exe
ClosedPublic

Authored by ikostia on Dec 14 2017, 9:39 AM.

Details

Summary

We already have the ability to customize the ssh command line arguments, let's
add the ability to customize its environment as well.

Example use-case is ssh.exe from Git on Windows. If HOME enviroment variable
is present and has some non-empty value, ssh.exe will try to access that
location for some stuff (for example, it seems for resolving ~ in
.ssh/config). Git for Windows seems to sometimess set this variable to the
value of /home/username which probably works under Git Bash, but does not
work in a native cmd.exe or powershell. Whatever the root cause, setting
HOME to be an empty string heals things. Therefore, some distributors
might want to set sshenv.HOME= in the configuration (seems less intrusive
that forcing everyone to tweak their env).

Test Plan
  • rt

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ikostia created this revision.Dec 14 2017, 9:39 AM
mbthomas accepted this revision.Dec 14 2017, 11:21 AM
mbthomas added a subscriber: mbthomas.

Looks reasonable to me. This could also be achieved by making SSH a script which sets the environment up and invokes the real SSH, but that's clumsy, whereas this allows use of config to set the env vars.

durin42 accepted this revision.Dec 15 2017, 4:14 PM
durin42 added a subscriber: durin42.

Ugh. But clearly needed.

This revision is now accepted and ready to land.Dec 15 2017, 4:14 PM
This revision was automatically updated to reflect the committed changes.